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 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
Post a Comment