|
awk: find and replace in certain field only, help needed
I got a sample file like this.
$ cat test
12|13|100|s
12|13|100|s
100|13|100|s
12|13|100|s
I want to replace all 100 by 2000 only in 3rd field using "awk"
This is replacing all 100's :-(
$ awk -F "|" '{gsub( /100/,"2000");print}' test
12|13|2000|s
12|13|2000|s
2000|13|2000|s
12|13|2000|s
I tried using something like this also - '$3 ~ /100/
but no luck :-(
Please help.
HTH,
jkl_jkl
|