I want to print all columns from nth
to last
column of a line
Input String in file
vddp vddpi vss cb0 cb1 cb2 cb3 ct0 ct1 ct2 ct3
Command
cat <file> | awk ' { for (i=3; i<=NF; i++) print $i }'
Current Output
cb0
cb1
cb2
cb3
ct0
ct1
ct2
ct3
Desired Output
cb0 cb1 cb2 cb3 ct0 ct1 ct2 ct3
I am trying the awk iteration, but cannot get desired output
Best Answer
This will take n as the value of
n
and loop through that number through the last fieldNF
, for each iteration it will print the current value, if that is not the last value in the line it will printOFS
after it (space), if it is the last value on the line it will printORS
after it (newline).