My goal is to insert id=“#” near every found “match” string when parsing a file. Instead of # must be an incrementing number.
There are plenty of files that need to be parsed.
I’ve tried:
counter=0
find -type f -name “*.html” | xargs sed -i “s/match/id=$((++counter)) match/g”
But counter is always 1.
(In addition, it would be good to set counter to 0 at the beginning of the new file, but most important is just to make it incremented).