Hello,

        A bash script would be a better choice for this particular request.

#!/bin/bash

find . -type f -name "*.txt" -print | xargs grep -l 123 >> externalfile

The above command would search the current directory plus all sub-
directories for all files the end in a ".txt" and search each file for
the string "123" and list the resulted files names in the file
"externalfile"


Michael


On Fri, 2005-05-06 at 11:11 -0400, macromedia wrote:
> Hello,
> 
> I'm not sure about the login or how I should approach what I want to
> achieve. I require a script that does the following.
> 
> 1. Search a directory and all sub-directories for a certain file
> extension. (Ex. .txt)
> 
> 2. Get the results of the above search and check "inside" each file for
> a string match. (Ex. "123").
> 
> 3. List the matches found into an external file for further processing.
> 
> What features should I be looking at to achieve this? Anyone know of
> some good examples that I could pick away at?
> 
> Josh
> 
> 
> 
> 
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to