[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: script copy files based upon content



On Fri, 05 Aug 2005 18:58:58 -0500, Michael Martinell wrote:

> I am trying to figure out how to come up with a shell script that will cat
> or grep a file and if it contains the word SPAM it will then move it to
> another folder.
> 
> I have been trying combinations of grep SPAM * | mv * ../spam [...]

Instead of a big loop, try this:

echo `grep -l SPAM *` ../spam
^echo^mv^

Yeah, I like to see what will go on before I do it...

tong




Reply to: