Printing everything except the first field with awk

前端 未结 16 2645
北恋
北恋 2020-12-04 07:04

I have a file that looks like this:

AE  United Arab Emirates
AG  Antigua & Barbuda
AN  Netherlands Antilles
AS  American Samoa
BA  Bosnia and Herzegovina         


        
16条回答
  •  渐次进展
    2020-12-04 07:55

    Assigning $1 works but it will leave a leading space: awk '{first = $1; $1 = ""; print $0, first; }'

    You can also find the number of columns in NF and use that in a loop.

提交回复
热议问题