I have many files in a SRC folder. I would like to move all the files that follow a particular pattern from this SRC folder to another DST folder along with rename the file with a required extension.
Sample Parameters
SRC directory /Vinodh
Files in /Vinodh folder are TEST01, TEST02, TEST03, TEST04
TEST02 & TEST03 contain the word WORLD
DST directory /TEST
I want to move the TEST02 & TEST03 files to /TEST folder as TEST02.txt and TEST03.txt
I will be typing the command as
cd /Vinodh
grep -l 'WORLD' *TEST*
mv TEST02 /TEST
mv TEST03 /TEST
cd /TEST
mv TEST02 TEST02.txt
mv TEST03 TEST03.txt
I'd like to combine all this to a single line statement or have batch file that copies all the files in a single shot.



