in reply to How do i search and extract commented lines from a file using perl?
Just for fun, a quick one-liner solution using perl's "flip-flop" (range) operator.
$ cat 1132036.txt This is line 1 /*This is line 2 This is line 3 This is line 4*/ This is line 5 $ perl -ne 'print unless /\/\*/ .. /\*\//' 1132036.txt This is line 1 This is line 5
Note that like several of the other solutions presented by other monks, this doesn't fully handle the case of the comment markers appearing in the middle of the lines.
|
|---|