AWK and mailq


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting AWK and mailq
# 1  
Old 12-16-2008
Question AWK and mailq

I need a simple script to parse the output of the mailq command and find emails from overseas addresses and delete them (ie user@xxx.co.uk, user@xxx.yyy.jp).

I found something close:

mailq | tail +2 | awk 'BEGIN { RS = "" } / *.co.uk / {print $1} ' | tr -d '*!' | postsuper -d -

but I can't quite figure out the wildcard syntax.

I'd be happy with the proper syntax or a better method overall. Smilie
# 2  
Old 12-16-2008
Code:
awk 'BEGIN { RS = "" } /.co.uk/ {print $1} '

# 3  
Old 12-16-2008
Too easy to be true... thanks... I might follow up with an additional question. Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Mailq regex match

Hi, # mailq | awk '{match($0, /quota/)} {print $0}' | head -Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient------- 9A6A7DE117E 84309 Sat Sep 30 14:14:50 alerts-noreply+xxxxx=xxx.sg@xxx.xx.xxx (host alt1.gmail-smtp-in.l.google.com said: 452-4.2.2 The email account that you... (2 Replies)
Discussion started by: ashokvpp
2 Replies

2. Shell Programming and Scripting

awk output yields error: awk:can't open job_name (Autosys)

Good evening, Im newbie at unix specially with awk From an scheduler program called Autosys i want to extract some data reading an inputfile that comprises jobs names, then formating the output to columns for example 1. This is the inputfile: $ more MapaRep.txt ds_extra_nikira_usuarios... (18 Replies)
Discussion started by: alexcol
18 Replies

3. Shell Programming and Scripting

Passing awk variable argument to a script which is being called inside awk

consider the script below sh /opt/hqe/hqapi1-client-5.0.0/bin/hqapi.sh alert list --host=localhost --port=7443 --user=hqadmin --password=hqadmin --secure=true >/tmp/alerts.xml awk -F'' '{for(i=1;i<=NF;i++){ if($i=="Alert id") { if(id!="") if(dt!=""){ cmd="sh someScript.sh... (2 Replies)
Discussion started by: vivek d r
2 Replies

4. Solaris

solaris 10u9 + sendmail 8.14.5 mailq grows, deferred messages

hello, I am using solaris 10 and sendmail 8.14.5 Main Problem i have growing (to 1500+ mails) mailq, and mailq consists of mails older then even 1 month. i have forced mailq by sendmail -q -v and messages went out. but it looks like, when messages enter to mailq they are not processed any... (0 Replies)
Discussion started by: lpic.lt
0 Replies

5. Shell Programming and Scripting

HELP with AWK one-liner. Need to employ an If condition inside AWK to check for array variable ?

Hello experts, I'm stuck with this script for three days now. Here's what i need. I need to split a large delimited (,) file into 2 files based on the value present in the last field. Samp: Something.csv bca,adc,asdf,123,12C bca,adc,asdf,123,13C def,adc,asdf,123,12A I need this split... (6 Replies)
Discussion started by: shell_boy23
6 Replies

6. Shell Programming and Scripting

Shell Script with mailq

Hi All, I'm a unix starter.. Need your help please. I need to write a simple shell script to implement mail queue size check. Pseudo code: Run mailq command If the queue size is greater than the predefined parameter (say 10), print message like : CRITICAL: Mail queue is XX . And exit 2... (1 Reply)
Discussion started by: vegabond
1 Replies

7. Shell Programming and Scripting

Awk problem: How to express the single quote(') by using awk print function

Actually I got a list of file end with *.txt I want to use the same command apply to all the *.txt Thus I try to find out the fastest way to write those same command in a script and then want to let them run automatics. For example: I got the file below: file1.txt file2.txt file3.txt... (4 Replies)
Discussion started by: patrick87
4 Replies

8. UNIX for Dummies Questions & Answers

mailx, why all my mail goes to mailq?

Hi, I sending mail like this: mailx -s "test" -r "from@me.com" to@you.com and I have update the /etc/mail/sendmail.cf with: DSsmtp-relay-nx-vip.xxx.yyy.com (this path is working on the old server) But all I mail goes to queue. What do I miss here? Regards Mehrdad (1 Reply)
Discussion started by: mehrdad68
1 Replies

9. Cybersecurity

found exploit mailserver through mailq?

First of all an appeal on all specialists to be understandfull with me, newbie. I have a RaQ 550 that I have to admin bymyself. I have executed mailq and found out that there are mails in the queu that I did not sent. Is someone exploiting my server? Here is an example of the report: ... (1 Reply)
Discussion started by: rolandk
1 Replies

10. UNIX for Dummies Questions & Answers

mailq

Dear guys !! Problems do not finish .. i have sun solaries 7 ,, ultra2 ,, mail server .. am checking server mailq now and it is loaded ,, so many requests up to 300 request . i checked netstat and did not find many or starnge smtp packets . but when i execute mailq i get mailq as... (3 Replies)
Discussion started by: tamemi
3 Replies
Login or Register to Ask a Question