|Problems? Is your data what you think it is?|
how to deal with newlineby nvdierdo (Initiate)
|on Oct 27, 2013 at 15:15 UTC||Need Help??|
nvdierdo has asked for the
wisdom of the Perl Monks concerning the following question:
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..
I tried the following which didn't work:perl -ne "print \"$1\n$2\n\" while /name=\"(.*)\".*id=\"(.*)\"/gs" myfile.txt
What is wrong with this?