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

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -