Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: 'mv' all files containing a certain string to a sub-directory



On 10/31/06, zzapper <david@xxxxxxxxxx> wrote:
Peter Stephenson <pws@xxxxxxx> wrote in news:200610311419.k9VEJaKf009817
@news01.csr.com:

> zzapper wrote:
>> I want to 'mv' all files containing a certain string to a sub-directory.
>> Should be trivial but cant think how w/o creating a temporary file
>
> mv *(.e:'grep -q string $REPLY':) subdir
>
Seeing PWS's reply reminded me of the conventional way to do this

mv $(grep -il "userid" *.php) done

That doesn't work with files with spaces in them, though.

 nikolai



Messages sorted by: Reverse Date, Date, Thread, Author