Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: 'mv' all files containing a certain string to a sub-directory
- X-seq: zsh-users 10913
- From: Jean-Rene David <jrdavid@xxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: 'mv' all files containing a certain string to a sub-directory
- Date: Tue, 31 Oct 2006 09:12:39 -0500
- In-reply-to: <Xns986D84207EE85zzappergmailcom@xxxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <Xns986D84207EE85zzappergmailcom@xxxxxxxxxxx>
On Tue, Oct 31, 2006 at 12:59:15PM +0000, 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
For non-recursive behavior:
for file in *; do
grep -q "somestring" "$file" && mv "$file" "somedir"
done
Recursive behavior is more tricky, as mentioned
elsewhere in this thread.
--
JR
Messages sorted by:
Reverse Date,
Date,
Thread,
Author