The following awk statement is working as expected.
It returns 1st, 2nd and last 4 columns from a text file delimited by |
awk '{print $1,"|", $2,"|", $(NF-3), "|",$(NF-2), "|", $(NF-1),"|", $(NF)}'
I will like to return the middle columns in between. In other words I need to replace the $something from the following line to something that will work.
awk '{print $1, $2, $something, $(NF-3), $(NF-2) $(NF-1), $(NF)}'
There can be 3 to 11 columns those will replace the something variable.
I think I have understood what you are expecting your output to look like. Try this line of
awk:Test input:
Test output:
HTH