https://stackoverflow.com/a/14348899/15603477
I do understand the following answer.
sed -r 's/(.*)(\?cache_version=)([0-9]+)(.*)/echo "\1\2$((\3+1))\4"/ge' file
But I wonder how to do it in awk.
To transform barbaz?cache_version=3fooooo
to barbaz?cache_version=4fooooo
The test1
file content as
ello
barbaz?cache_version=3fooooo
bye
The condition is find line contain cache_version=
then increase the numeric value in the matched line by 1.
I even fail to locate the matched numeric value, not even mention increase the numeric value.
So far I only locate the specific line by
awk '{if(/cache_version=([[:digit:]+])/) print $1}' < test1