I have a text file like this:
$ cat test
12 13 2100 s
12 13 3100 s
100 13 100 s
12 13 300 s
I want the output to be like this:
$ cat test
12 13 22000 s
12 13 32000 s
100 13 2000 s
12 13 300 s
I only want to replace 100 in field 3 (once 100 is contained in $3) into 2000. How can I accomplish this job using awk?
Here’s one way using
awk:Results: