I've probably got the wrong end of the stick at this time of night, er,
morning but something like

find /basepath -type f -exec grep -H sometext {} \;

would grep all files in directories under /basepath and print out filenames
and lines that matched.

Brad.

On Thu, 17 May 2001 00:19, Paul Robinson <[EMAIL PROTECTED]> wrote:

> Hi Sluggers,
>          Got a problem writing a shell script in sh. What it's supposed to 
> do is look at a base path, get a directory listing and for each directory 
> there it needs to concat the base path with the dir name and run a cat * 
> |grep "sometext" on each.
> 
> I can get a directory listing by doing a ls -l |cut -b 47-57 and that gives 
> a list of directories but I cannot get either the path concatination 
> working or the "do for each" bit working.
> 
> Are there any sh guru's out there who could point me in the right direction 
> code wise? (nb it has to be /bin/sh as it's the only shell the system uses. 
> otherwise I'd write a little perl script that could do this with ease).
> 
> Cheers,
> Paul
> 
> "The generation of random numbers is too important to be left to chance."
> -- anon.
> 
> 
> 
> -- 
> SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
> More Info: http://lists.slug.org.au/listinfo/slug

-- 

-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to