Match a pattern and print whole line containing matched pattern.

Well.. I was wondering to capture whole line, when I have already one field, and I did it with the help of my friend via awk.

A simple “awk” trick to match a pattern and print whole line containing matched pattern.

# cat <any_large_file/log>|awk ‘$3 ~ /<pattern to look for>/ {print $_}’

It will match a pattern in 3rd field of supplied file and if pattern found whole row/line will be printed on standard output.

Cheers!!

How you can empty your qmail queue

After a long time updating my blog. well I have many things to share but yes I will do it as soon as i get time.

For this time a small qmail queue deletion script tip as mentioned given.

#!/bin/sh

#  STOP services of Qmail first
/sbin/service qmail stop or qmailctl stop

for i in bounce info intd local mess remote todo; do

find /var/qmail/queue/$i -type f -exec rm {} \;
done
/sbin/service qmail start

However, there are multiple ways to delete the qmail queue, but I prefer this because it worked like a charm!!