I have a text file with two columns and more than 3,00,000 rows. Format is as below Filename1.txt Num1Filename2.txt Num2Filename3.txt Num3I want to copy all the filenames for which the corresponding Numx is greater than 50 and less than 200 into a different file. Once I copy those file names into a different file, I want to copy all of those files into a different folder. How do I do that?
Filter columns basing on the value of other column
text processing;sed;awk;grep;cp
If you want you can do the comparison and copying at the same time with awk:awk '$2>50 && $2<200 {system(cp -- $1 /path/to/destination/)}' file.txtAssuming you want to copy the files to destination directory, change this to meet your need.$2>50 && $2<200 does the required comparisonif matches, then the cp operation is executed ({system(cp -- $1 /path/to/destination/)}), done by the system() function of awk