Regular Expression Trouble
Parv
parv at pair.com
Fri Dec 9 22:24:16 PST 2005
in message <6.2.3.4.2.20051209145132.025e64c0 at cobalt.antimatter.net>,
wrote Glenn Dawson thusly...
>
> At 02:12 PM 12/9/2005, Martin McCormick wrote:
> >
> > I was hoping to get only the A records from a dns zone file so
> >the expression I used is:
> >
> >egrep [[:space:]IN[:space:]A[:space:]] zone_file >h0
> >
> > Had it worked, all that would have appeared in the h0 file was
> >all the A or Address records. Instead, I get those plus almost
> >everything else in the file.
> try:
>
> egrep "IN[^[:alnum:]]+A" zone_file
For even finer results, use word boundaries ...
egrep '\bIN[^[:alnum:]]+A\b' file
egrep '\<IN[[:space:]]+A\>' file
- Parv
--
More information about the freebsd-questions
mailing list