Printing everything except the first field with awk

前端 未结 16 2643
北恋
北恋 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

    A first stab at it seems to work for your particular case.

    awk '{ f = $1; i = $NF; while (i <= 0); gsub(/^[A-Z][A-Z][ ][ ]/,""); print $i, f; }'
    

提交回复
热议问题