awk ternay operator, count fs with , -


how make command line:

awk -f "," '{nf>0?$nf:$0}' 

to print last field of line if nf>0, otherwise print whole line?

working data

bogota dept math, bogota 

  awk -f, '{ print ( nf ? $nf : $0 ) }' file 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

c# - Exception when attempting to modify Dictionary -