find files and copy them to a certain folder in bash (draft)

find . -name “*” | grep -i scomm | xargs ls -ltr | grep “Aug 13 10” | awk ‘{print $9}’

to use in the cp command (get the column number 9 which contains the file’s full path

cp `find . -name “*” | grep -i scomm | xargs ls -ltr | grep “Aug 13 10” | awk ‘{print $9}’` /sfs/aamr/scomm/sbprd02

If the search_string contains any special characters (e.g. dot, slash, double quotations …etc, then preceed it by a ‘\’

About SoCRaT

Systems Engineer, OSS & Linux Geek
This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s