Monday, August 31, 2015

Grep files from file list

Following Linux script can be used to grep files from file list. Suppose you have file name list in "test2" file. Then, you can use following script to grep files in current location and copy these files to "/home/sujith/files/.

for k in `cat /home/sujith/test2`; 
do echo $k; 
cp *$k /home/sujith/files/.;
done

No comments:

Post a Comment