Re: need script
On Mar 25, 10:40am, "aixd...@yahoo.com" <aixd...@yahoo.com> wrote:
> On Mar 25, 10:09am, pk <p...@pk.invalid> wrote:
>
>
>
>
>
> > aixd...@yahoo.com wrote:
> > > On Mar 24, 1:08pm, "aixd...@yahoo.com" <aixd...@yahoo.com> wrote:
> > >> only want to report first line, each time PNAM= value changes
> > >> second field delimited by | character
> > >> sample of source file
>
> > >> STAR=20080317 20:43:59|PNAM=ABSPC103
> > >> STAR=20080318 20:42:53|PNAM=ABSPC103
> > >> STAR=20080319 20:43:27|PNAM=ABSPC103
> > >> STAR=20080320 20:43:00|PNAM=ABSPC103
> > >> STAR=20080321 20:41:41|PNAM=ABSPC103
> > >> STAR=20080301 01:41:49|PNAM=ACFPC360
> > >> STAR=20080302 02:35:03|PNAM=ACFPC360
> > >> STAR=20080303 01:10:23|PNAM=ACFPC360
> > >> STAR=20080319 03:56:12|PNAM=EDIPP757
> > >> STAR=20080320 03:54:41|PNAM=EDIPP757
> > >> STAR=20080321 03:55:14|PNAM=EDIPP757
> > >> STAR=20080322 03:53:57|PNAM=EDIPP757
> > >> STAR=20080301 12:02:48|PNAM=HHRAC010
> > >> STAR=20080301 18:02:48|PNAM=HHRAC010
> > >> STAR=20080303 12:04:33|PNAM=HHRAC010
>
> > >> etc
>
> > > I would also like to grab fields starting with SFIL= and DFIL=
> > > however these fields are NOT consistently in the same field position
> > > of every line
>
> > Provide sample input and expected output.
>
> > --
> > All the commands are tested with bash and GNU tools, so they may use
> > nonstandard features. I try to mention when something is nonstandard (if
> > I'm aware of that), but I may miss something. Corrections are welcome.- Hide quoted text -
>
> > - Show quoted text -
>
> input file looks like
>
> STAR=20080320 17:00:51|PNAM=SRCP|RSTR=N|SFIL=SRCPPPB|SBYX=252685 |DFIL=/
> connect2/filea
> STAR=20080301 00:48:22|PNAM=TAGP|SFIL=TAGPFPB|SFSZ=55800|DFIL=/ndm/hil/
> fileb|DBYW=25425
> STAR=20080301 00:48:16|PNAM=TAGP|SFIL=TAGPFPC|SFSZ=27900|DFIL=/ndm/hil/
> filecl|DBYW=500
> STAR=20080303 11:04:43|PNAM=TELP|RSTR=N|SFIL=TELPCPB|SBYX=1134|D FIL=/
> ndm/hil/filee
>
> want output to be
>
> field 1 STAR=
> fileld 2 PNAM=
> field 3 SFIL=
> filed 4 DFIL=
>
> don't care about other items- Hide quoted text -
>
> - Show quoted text -
actually output to be exact, should look like this for each line
STAR=data|PNAM=data|SFIL=data|DFIL=data
|