You're replying to a comment by Stuart Marmorstein.

April 29, 2013, 01:21

hi Peter,

Thanks to you, I can get many tasks done requiring searches through groups of files using wildcards as in:

perl -pi.bak -e "BEGIN{@ARGV=<*.ini>} /77345/ && s/Humble/Kingwood/"

which changes the name of the town, Humble, to Kingwood in a group of .ini files if the zip code is 77345.

Next question for a practical application:

I use a command line program in Win 7 called getmail, which downloads emails from one of my accounts and saves them as .txt files in the form msg*.txt.

I would like to have a Perl one-liner that can read through these files looking for certain text strings that would identify them to me as SPAM.

How could I get a one-liner to take the FILENAME of the offending file and write it to a line in another text file that I could use to delete SPAM emails?

I have done something similar with sgrep, and it seemed to work for a while, but lately some inconsistent results are cropping up.

All the best--Stuart

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "lcd_303": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.