Fun with the shell…

โ€”

by

in

Ok… so I had to delete a lot of spam from one of our Linix servers. I needed to…

  • get a list of active subject lines
  • count unique subject lines / words
  • sort that list in descending order

So here is the first part…

./qmHandle -l | grep Subject | sort | uniq -c | sort -nr | more

That works for anything of course, any source of lines. It isn’t particularly cleaver. However, as I nuked the lines I realized maybe I could do a simple count of words and get a better idea of “trigger” words. How to turn that list of lines to a list of words? Thanks to “tr” of course.

./qmHandle -l | grep Subject | tr ‘ ‘ ‘n’ | sort | uniq -c | sort -nr | more

So there you have it, a list of the most common words. Obviously it is rough, but it worked for me.