On Wed, 27 Apr 2011 16:35:12 -0600
Alan Young <[email protected]> wrote:

> On Wed, Apr 27, 2011 at 15:59, Charles Curley
> <[email protected]> wrote:
> >> '\b((s?he)|it)\b'
> >
> > Let's see it from the command line so we know which .?grep you used.
> 
>  $ echo 'there sit she' | egrep --color '\b((s?he)|it)\b'
> there sit she
> 
>  $ echo 'there sit she' | sed -r 's/\b((s?he)|it)\b/Matched: "\1"/;'
> there sit Matched: "she"
> 
>  $ echo 'there sit she' | perl -ne '/\b((s?he)|it)\b/ && print "$1\n"'
> she

Much better; danke.

For the first one, try:

charles@yendi:~$ echo 'there sit she' | egrep -o --color '\b((s?he)|it)\b'
she
charles@yendi:~$ echo 'there sit' | egrep -o --color '\b((s?he)|it)\b'
charles@yendi:~$ echo 'there sit it' | egrep -o --color '\b((s?he)|it)\b'
it
charles@yendi:~$ 

Which I think is what you wanted.

-- 

Charles Curley                  /"\    ASCII Ribbon Campaign
Looking for fine software       \ /    Respect for open standards
and/or writing?                  X     No HTML/RTF in email
http://www.charlescurley.com    / \    No M$ Word docs in email

Key fingerprint = CE5C 6645 A45A 64E4 94C0  809C FFF6 4C48 4ECD DFDB

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to