Groups | Search | Server Info | Login | Register
| From | gio001 <gcrippa@gmail.com> |
|---|---|
| Newsgroups | comp.lang.awk |
| Subject | Regular expression in awk |
| Date | 2011-04-06 07:40 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <4e09d4fd-8351-45f0-8f17-b6ac0d32e19a@l18g2000yql.googlegroups.com> (permalink) |
Hello,
I have thousand of messages (HL7), I want to use awk to extract only
the ones that have a particular value in pv1.18
Each record in the file is the whole HL7 message, ie. when I print $0
I get the whole message MSH EVN PID etc. ,there is an x0d between the
segments.
I would like to use a line somewhat like:
awk '{if(/PV1\|\([^|]*\|\)\{16\}\|X/){print $0}}' infile > outfile
I do not seem to be able to get this working properly in awk on a AIX
box.
Yet this statement works fine against the infile:
grep 'PV1\|\([^|]*\|\)\{16\}\|X' infile
Can anyone please help?
Thanks.
Back to comp.lang.awk | Previous | Next — Next in thread | Find similar
Regular expression in awk gio001 <gcrippa@gmail.com> - 2011-04-06 07:40 -0700
Re: Regular expression in awk pk <pk@pk.invalid> - 2011-04-06 16:01 +0100
Re: Regular expression in awk Janis Papanagnou <janis_papanagnou@hotmail.com> - 2011-04-06 19:24 +0200
Re: Regular expression in awk Manuel Collado <m.collado@domain.invalid> - 2011-04-06 21:07 +0200
Re: Regular expression in awk gio001 <gcrippa@gmail.com> - 2011-04-06 12:25 -0700
Re: Regular expression in awk Janis Papanagnou <janis_papanagnou@hotmail.com> - 2011-04-06 23:09 +0200
Re: Regular expression in awk gio001 <gcrippa@gmail.com> - 2011-04-06 19:59 -0700
Re: Regular expression in awk Loki Harfagr <l0k1@thedarkdesign.free.fr.INVALID> - 2011-04-07 07:32 +0000
Re: Regular expression in awk gio001 <gcrippa@gmail.com> - 2011-04-07 05:06 -0700
Re: Regular expression in awk Loki Harfagr <l0k1@thedarkdesign.free.fr.INVALID> - 2011-04-07 13:34 +0000
Re: Regular expression in awk gio001 <gcrippa@gmail.com> - 2011-04-07 08:27 -0700
Re: Regular expression in awk Loki Harfagr <l0k1@thedarkdesign.free.fr.INVALID> - 2011-04-07 18:32 +0000
Re: Regular expression in awk Geoff Clare <geoff@clare.See-My-Signature.invalid> - 2011-04-07 13:34 +0100
Re: Regular expression in awk arnold@skeeve.com (Aharon Robbins) - 2011-04-07 13:31 +0000
Re: Regular expression in awk Geoff Clare <geoff@clare.See-My-Signature.invalid> - 2011-04-08 13:18 +0100
csiph-web