balamw said:
You can play all kinds of lovely games with grep, sed and awk. So much so they wrote a nice O'Reilly book about them.
grep, sed, and awk are probably the 3 most underused commands in unix (in that people may use them, but rarely truly exercise what they can do).
Although find and xargs are pretty good candidates too.
Master those 5 commands, and it is amazing what you can do in a single line.
with -A and -B so you can look for strings in lines adjacent to matches etc...
I run my own mailserver, and let any address come in, so when I give emails I can make them up on the fly (company name) so I can track spam. I run this periodically on my Spam folder:
grep -a -C15 "personal@myemail.com" Spam | grep "Subject: " | sort | uniq -c | egrep "^[ ]+1"
To check for any personal emails that got caught. It shows me any unique subjects (so it filters the 100 vi@gra spams I have) that came to my personal address so I can quickly scan for somebody that sent me an message that got binned wrongly. Cuts out an incredible amount of chaff.