I have 2 files, one having 2 columns, another having 1 column. The second file is sorted using sort -u. Now the task is I need to join this column with the first column of the first file, which is not sorted, so what will be the syntax? will this work? join -j 1 file2.txt sort -s -n -k 1 file1.txt? The output I want is actually the 2nd column of file 2 after joining and the uniq entries in it.
File 2
1
2
3
File 1
2 500
1 5000
1 300
3 3000
3 300
4 450
Output
5000
300
500
3000

File 2? Is sortingFile 1and then removing unwanted entries, e.g., lines with prefix >= 4 || duplicate values out of the question? – tojrobinson Sep 28 '12 at 8:30