in reply to Matching columns between files
And here's what the usage might look like to have that script output the combined contents of lines from two files, where columns 1,2,3 of fileA match columns 2,3,4 of fileB (first column is #1):
Now, as a first try, the output will be more than you actually want: it prints the full content of both matching lines. (And if key columns are not unique within one of the files -- e.g. fileA has multiple lines with the same combination of values in columns 1,2,3 and these match a row in fileB -- you'll get multiple lines from that file that match a single line from the other file.)cmpcol -i -lb tab fileA:1,2,3 fileB:2,3,4
But you can easily filter the output to trim out the unwanted columns. And maybe the "cmpcol" script itself will give you some ideas for how to write a script that does exactly what you want.
|
|---|