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

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



Are you looking for smth like:

find . -type f -exec grep -e "a certain string" {} \; -exec mv {} tmp \;

HTH

Heinrich's suggestion would move files both in the current directory
and subdirectories that match your search string.  If you only want
the current directory, you should be fine to use a

mv *somestring* tmp

~Matt

PS - Sorry Heinrich, I accidentally sent this to you instead of the
list at first.  My bad.  :)

On 10/31/06, Heinrich Götzger <goetzger@xxxxxx> wrote:
zzapper wrote:
> Hi
> 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
>
>
>

Are you looking for smth like:

find . -type f -exec grep -e "a certain string" {} \; -exec mv {} tmp \;

HTH

Heinrich



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