Re: grep regular expression for this
- From: "John W. Krahn" <someone@xxxxxxxxxxx>
- Date: Mon, 31 Mar 2008 07:59:32 GMT
sinbad wrote:
grep should match a string like abc and should match whatever word
that follows it, and display
only these two matching words.
for example
-----------
abc
abc xyz
abcd
some text abc def
In the above file grep should match only lines 2 and 4 and give output
abc xyz
abc def
what can be the possible regular expressions
$ echo "abc
abc xyz
abcd
some text abc def" | egrep -o 'abc +[[:alpha:]]+'
abc xyz
abc def
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
.
- References:
- grep regular expression for this
- From: sinbad
- grep regular expression for this
- Prev by Date: grep regular expression for this
- Next by Date: Re: 64-bit c++ application crashing on solaris
- Previous by thread: grep regular expression for this
- Index(es):