I'm looking to conditionally select two columns from the third line of a file based on the first column of the first line of the file.
Here is the file format:
v1
shortdesc
value1 value2 value3 value4 ...
Using this example, I'd want value2 and value3 if v1, otherwise, I'd like value1 and value4.
I know how to get the line and column using something like awk 'FNR ==1 {print $1} but how do I use the if clause?
The code that is not working for me looks something like this:
awk '{if("NR == 1 $1"=="v1") {FNR==3 print $2 "\t" $3;} else {FNR==3 print $1 "\t" $4;}}'