perl -ne 'BEGIN{ $s=q ~(.*)$/'"'"',$lines,$matches) 10.(.*)$/'"
+'"',$lines,$matches) (.*)$/'"'"',$lines,$matches)~};print unless
+/\Q$s\E/' input.txt
Instead of doing an in-place replace , You can redirect the output of this to the final file.
It seems like "\Q" and the "$" symbol do not interact well when directly in a RE.
If you put the "$" symbols outside \Q..\E , it seems to work.
Here is the quote from http://www.perl.com/doc/manual/html/pod/perlre.html
You cannot include a literal $ or @ within a \Q sequence. An unescaped $ or @ interpolates the corresponding variable, while escaping will cause the literal string \$ to be matched. You'll need to write something like m/\Quser\E\@\Qhost/.
So, this one works too ..(But it sure is UGLY!)
perl -ne 'print unless m~\Q(.*)\E\$/'"'"',\$lines,\$matches\Q)
+ 10.(.*)\E\$/'"'"',\$lines,\$matches\Q) (.*)\E\$/'"'"',\$lines,\$
+matches\)~x' input.txt
Have you been high today? I see the nuns are gay! My brother yelled to me...I love you inside Ed - Benny Lava, by Buffalax
|