sed - How to replace second column of csv file with a specific value "XYX" -
to replace last field of csv file xyz use following command:
awk -f, '{$nf="xyz";}1' ofs=, file how can overwrite second column of file value xyz?
in awk variable nf number of fields on current line. can refer each field $1,$2...$nf $1 first field , $2 second field, upto $nf last field on current line (i.e. if nf 5 $nf $5).
$ cat file 1,2,3,4,5 $ awk '$2="xyx"' fs=, ofs=, file 1,xyx,3,4,5
Comments
Post a Comment