I want to match 2 strings on different lines in a file. The strings are not on the same line. New lines are coded as a <cr><lf> pair (windows).
My text file is myfile.txt:
..some random text..name="Bob"..some more random text containing new lines..
..some random text..id="437"..yet some more text
I tried the following which didn't work:
perl -ne "print \"$1\n$2\n\" while /name=\"(.*)\".*id=\"(.*)\"/gs" myfile.txtWhat is wrong with this?
In reply to how to deal with newline by nvdierdo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |