i have huge file(~2000000 lines) and i am trying to replace few different patterns while i am reading the file only once.
so i am guessing sed is not good since i have different patterns i tried to use awk with if else but the file is not change
#!/usr/bin/awk -f
{
if($0 ~ /data for AAA/)
{
sub(/^[0-9]+$/, "bla_AAA", $2)
}
if($0 ~ /data for BBB/)
{
sub(/^[0-9]+$/, "bla_BBB", $2)
}
}
I expect the output of
address 01000 data for AAA
....
address 02000 data for BBB
....
to be
address bla_AAA data for AAA
....
address bla_BBB data for BBB
....