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/Vinodh
Files in /Vinodh/Vinodh folder are TEST01TEST01, TEST02TEST02, TEST03TEST03, TEST04TEST04
TEST02 & TEST03 containsTEST02 & TEST03 contain the word WORLDWORLD
DST directory /TEST/TEST
I want theto move the TEST02TEST02 & TEST03 fileTEST03 files to /TEST/TEST folder as TEST02.txtTEST02.txt and TEST03.txtTEST03.txt
iI 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
cd /Vinodh
grep -l 'WORLD' *TEST*
mv TEST02 /TEST
mv TEST03 /TEST
cd /TEST
mv TEST02 TEST02.txt
mv TEST03 TEST03.txt
I wantI'd like to combine all this to a single line statement or i want ahave batch file that copies all the files in a single shot.