On Fri, Aug 05, 2005 at 08:31:30PM -0400, Ryan King wrote: > On Fri, Aug 05, 2005 at 06:58:58PM -0500, Michael Martinell wrote: > > I have been trying combinations of grep SPAM * | mv * ../spam however I > > don't know what to put in for * since the filenames are always changing. > > Try something like this: > for n in *; do > grep SPAM $n >/dev/null && echo $n > done
Oh yeah, I guess this may not be obvious to everyone who might read this mail... you have to change that "echo $n" to "mv $n ../wherever" once you confirm that the loop isn't broken. When I'm doing shell loops, I always prototype them with "echo", because it can be easy to make a big mess in a hurry. -rjk -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]