Discussion: need script help
Afficher un message
Vieux 24/03/2008, 19h30   #3
pk
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: need script

aixdude@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


IIUC,

awk -F'=' '$NF!=pnam && pnam=$NF' file.txt

--
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.
  Réponse avec citation
 
Page generated in 0,04914 seconds with 9 queries