Awk + print all line content except $1

awk

I write the follwoing awk script:

% echo /var/sysconfig/network/my_functions  alpha beta gama  | \
      awk -v word=alpha '$2  == word { print $0 }'

how to tell awk that I want to print all line except $1 (/var/sysconfig/network/my_functions PATH ) so I will get the following:

alpha beta gama

instead of

/var/sysconfig/network/my_functions alpha beta gama

remark: line content can be anything and not limit by strings/word quantity

Best Answer

I think in awk there's no way but to remove the first field manually. (There are other ways if you're willing to normalize the inter-field space.)

awk '$2 == word {match($0, "("FS")+"); print substr($0, RSTART+RLENGTH);}'
Related Question