I've got an input file (input.txt) like this:
name value1 value2 A 3 1 B 7 4 C 2 9 E 5 2
And another file with a list of names (names.txt) like so:
Using grep -f, I can get all the lines with names "B" and "C"
grep -wFf names.txt input.txt
B 7 4 C 2 9
However, I want to keep the header at the top of the output file, and also rename the column name "name" with "ID". And using grep, to keep the rows with names B and C, the output should be:
**ID** value1 value2 B 7 4 C 2 9
I'm thinking awk should be able to accomplish this, but being new to awk I'm not sure how to approach this. Help appreciated!