I am trying to do a sed substitution over two lines like this:
sed -r '/user-type/{N;s/user-type: (.*)\n.*gth: .*([0-9]+).*$/\1 \2/}' I got this syntax from an answer here, which explains I first match the first line of the pattern and then add the next line to the pattern space with N to make the substitution. This has worked for me on previous occasions, but this time the weirdest thing happens.
For input:
user-type: admin password minumim length: 8 user-type: auth password minumim length: 8 I get:
8min 8th When I expected:
admin 8 auth 8 It looks like the second saved match is printed from the beggining of the line and replaces what was previously printed.
Any idea?