1
rated 0 times
[
1]
[
0]
/ answers: 1 / hits: 3129
/ 2 Years ago, fri, april 15, 2022, 8:27:21
I have text file similar to this:
Some-text
Keyword
Some-text
Some-text
Keyword
Some-text
Keyword
Keyword
I want to replace every "Keyword" with "number.extension" where number is 1 at first keyword match, 2 at second keyword match etc.
I know that I should use bash loop combined with sed (sed 's:Keyword:Number:g'), but I am not sure how to insert variable for number in that sed command.
As this is HTML file, there can be blank lines or any text beetween those "Keywords".
More From » bash