Home Messages Index
[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index

Re: Grepping a directory of files

__/ [axel@xxxxxxxxxxxxxxxxxxxxxx] on Monday 07 November 2005 16:14 \__

> Roy Schestowitz <newsgroups@xxxxxxxxxxxxxxx> wrote:
>> __/ [David Bolt] on Sunday 06 November 2005 20:23 \__
> 
>>> There's probably much more elegant, shorter, and/or quicker methods, but
>>> here's one that should do the job:
>  
>>> grep -a -l "JFIF" * | \
>>> awk -F: '{print $1}'| \
>>> while read i ; do cp "$i" /wherever/you/want/the/files ; done
>  
>>> Just replace JFIF to match other identifying strings, and the
>>> destination, as required.
>  
>> I suspect that the above assumes all files reside in the same directory.
>> Let us say that all 3 lines were saved under a file named move_jfif.sh.
>> You could then use global.sh (see below)
> 
> Then just use the -r option with the grep.

Oh, that's easier. *frown*

I guess 'global' remains a useful snippet of code in all of these
circumstances where recursiveness is not an option.

Roy

[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index