Hello.
How do I find and replace a string with a specific starting value?
I have this text:
xx
xx
xx
and would like to replace it with:
0
1
2
My awk code is contained in my regex.awk file and run from my Mac's Terminal. This code works fine but it starts replacement at value '1' and I want it to be '0'. I've search the forum but couldn't an answer.
awk:
sub(/xx/,++c)
Terminal:
awk -f awkRegex.awk test.txt > test.tmp && mv test.tmp test.txt
How do I find and replace a string with a specific starting value?
I have this text:
xx
xx
xx
and would like to replace it with:
0
1
2
My awk code is contained in my regex.awk file and run from my Mac's Terminal. This code works fine but it starts replacement at value '1' and I want it to be '0'. I've search the forum but couldn't an answer.
awk:
sub(/xx/,++c)
Terminal:
awk -f awkRegex.awk test.txt > test.tmp && mv test.tmp test.txt