2009/10/16 Chris Allen <ca.al...@gmail.com>:
> smoothly with the least amount of code.  One thing in particular is
> driving me crazy - I can't figure out how to output only the contents
> of my match groups with pcregrep.

I'm not familiar with pcregrep, nor is my answer related to Perl, but
gnu grep has an -o or --match-only option, which only outputs the
portion of the input that matches your regular expression. I'm not
sure how it handles groups though, so a bit of experimenting would be
needed. I'm sure a quick "sed" or "grep -v" will help get rid of the
stuff you don't want.

So, give this a try, and see if it helps:

echo s dir | bconsole | pcregrep -o -M '^Sched.*:\n(.*\n)*?^===$' |
grep -v === | grep -v Sched

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to