Hi All,
I want to know how to grep and delete (remove) files .
What I need is that there are some unwanted out going mails in the queue in my Centos 4.4 Sendmail Server. I can find them with the below commad.
mailq /var/spool/mqueue/ |grep '<>'
Then It displays all the mails of that type withg their ids in the following way.
[root@gateway ~]# mailq /var/spool/mqueue/ |grep '<>' kA63ZwJT007450 13864 Mon Nov 6 09:05 <> kA63LqO3004442 4110 Mon Nov 6 08:51 <> kA63V7Tn006327 16913 Mon Nov 6 09:01 <> kA62vH4t031111 13880 Mon Nov 6 08:27 <> kA62r6WW030077 13975 Mon Nov 6 08:23 <> kA63BxYQ002455 16443 Mon Nov 6 08:41 <> kA62MW0w023058 13536 Mon Nov 6 07:52 <> kA62jQah028236 13625 Mon Nov 6 08:15 <> kA62gLTw027445* 13710 Mon Nov 6 08:12 <> kA62JXwd022569 13849 Mon Nov 6 07:49 <> kA62idkg028035 13949 Mon Nov 6 08:14 <> kA62PEHX023554* 14152 Mon Nov 6 07:55 <> kA62W7Dd024920 14203 Mon Nov 6 08:02 <> kA62TtJn024569 14245 Mon Nov 6 07:59 <> kA62TU2j024446 14262 Mon Nov 6 07:59 <> kA62ZL0E025726 15878 Mon Nov 6 08:05 <> kA62MW6J023059 17106 Mon Nov 6 07:52 <> kA6266rV019846 13678 Mon Nov 6 07:36 <> kA62FXCd021741 13693 Mon Nov 6 07:45 <> kA626v5u020008 13718 Mon Nov 6 07:36 <> kA62X36L025101 13873 Mon Nov 6 08:03 <> kA62Xd6u025234 13901 Mon Nov 6 08:03 <> kA62RMT8023973 14008 Mon Nov 6 07:57 <> kA62Ufi6024703 14014 Mon Nov 6 08:00 <> kA62JxSm022664 14044 Mon Nov 6 07:49 <> kA62Q0Sd023738 14057 Mon Nov 6 07:56 <> kA62VgKI024882 14116 Mon Nov 6 08:01 <> kA62QmtQ023890 14129 Mon Nov 6 07:56 <> kA623NxG019271 13740 Mon Nov 6 07:33 <> kA620tLk018801 14004 Mon Nov 6 07:30 <> kA61q1PS017035 14094 Mon Nov 6 07:22 <> kA6215S7018835 14154 Mon Nov 6 07:31 <> kA61kYX8015811 13536 Mon Nov 6 07:16 <> kA61c63T014124 13811 Mon Nov 6 07:08 <> kA61WhXL013089 10232 Mon Nov 6 07:02 <>
Now I want to know how to remove them.
Then I can set up a crontab to do it evey 5 minutues.
Any help .. pls