theninja has asked for the wisdom of the Perl Monks concerning the following question:
Hi I am having a hellofa time converting my shell script to a perl script. I am hoping to find some direction. The shell script basically searchs the system for all files and checks them for certain words, then pipes the output to a file, then strips out "fale-positive" results, and sends results to a file, then emails and ftp's file. On the perl side what I am having trouble with is the "grep"ing of the words out of the files. In the shell script I do this by
this gives me the list of files that contain the word(s) in words.dat. I can get perl to work if I use each word individualy like this...while read words.dat do find . -type f | xargs grep -i "${words.dat}=" 2>/dev/null >> out.log done < words.dat
but I need to feed it a list of words in a file. How can I do this? thanks@find = `find . -type f | xargs grep -i sales= 2>/dev/null`; @find = `find . -type f | xargs grep -i price= 2>/dev/null`; @find = `find . -type f | xargs grep -i invoice= 2>/dev/null`;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help with script to search all files for certain words.
by roboticus (Chancellor) on Jan 10, 2011 at 21:39 UTC | |
by afoken (Chancellor) on Jan 11, 2011 at 09:23 UTC | |
|
Re: Help with script to search all files for certain words.
by mikeraz (Friar) on Jan 10, 2011 at 21:36 UTC | |
|
Re: Help with script to search all files for certain words.
by philipbailey (Curate) on Jan 10, 2011 at 22:46 UTC | |
|
Re: Help with script to search all files for certain words.
by eff_i_g (Curate) on Jan 10, 2011 at 23:39 UTC |