"be consistent" | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Greetings! I just registered here and hope this is an appropriate venue for my question. I'm new to perl and am trying to write a perl one-liner that returns everything from the first non-indented line of a file up until the end of that paragraph, terminated by a blank line. I can do this using awk with the command: My problem translating this to perl is that the first non-indented line of the file may or may not be the first line of the file. In the former case, this works: as does this: In the latter case, this works: But is there a simple perl one-liner that works in both cases? I've tried writing a semicolon-separated perl command intended to prepend a blank line to the file before the search in the event that the first line is not indented, using something like but I can't get the syntax right. Obviously I could string together a sequence of commands like or use some bash conditional like however, I'd like to know if there's some more elegant "pure perl" solution I'm overlooking. Best regards, Maneesh In reply to matching first paragraph satisfying condition by mnshptl32
|
|