awk - How to replace other column-entries when searching for a specific column in a file? -
suppose file looks this:
a 1 0 b 1 0 c 1 0
how can search line has b in first column, , if so, switch entries in second , third column? final result like:
a 1 0 b 0 1 c 1 0
try -
vipin@kali:~$ awk '{if($1 == "b") {print $1,$3,$2} else print $1,$2,$3}' kk 1 0 b 0 1 c 1 0
Comments
Post a Comment