On Sat, 28 Mar 2020, Tomas Kuchta wrote:
You did not give example of the text you are parsing. So, I assume that you
want to replace B(W) literal in column 2 with number 11.
Tomas,
Yes, in each row where field 2 is B(W).
Try this:
awk '$2 == "B(W)" { $2=11; print $0 }'
$ gawk -f change-station-name-to-id.awk benthos.csv > out.dat
$ $ ll out.dat
-rw-r--r-- 1 rshepard users 0 Mar 29 05:47 out.dat
Or as regexp:
awk '$2 ~ /B(W)/ { $2=11; print $0 }'
$ gawk -f change-station-name-to-id.awk benthos.csv > out.dat
$ $ ll out.dat
-rw-r--r-- 1 rshepard users 0 Mar 29 05:47 out.dat
I'll re-read my awk book again as I must have missed the proper syntax in my
previous searches.
Thanks,
Rich
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug