Printing everything except the first field with awk

前端 未结 16 2678
北恋
北恋 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 08:00

    The field separator in gawk (at least) can be a string as well as a character (it can also be a regex). If your data is consistent, then this will work:

    awk -F "  " '{print $2,$1}' inputfile
    

    That's two spaces between the double quotes.

提交回复
热议问题