I haven't following this very closely, but my understanding
is the gawk(1) script in question is basically:
/RE₁/ { x = $1; }
/RE₂/ { y = $3; }
{ print x, y; }
and the “problem‟ is apparent-duplicate lines are printed.
well, what else do you expect the script to do?
of course it will print an output line for every input line;
the 3rd ACTION (the last one, with no PATTERN) matches every
input, so the last-assigned values-to-print («x» and «y» in
my example above) are printed as the output.
the solution? below, I am assuming nothing is to be printed
until all of the values-to-print have been set, and then the
cycle repeats. this is _not_ robust, yer kiloage will vary!:
BEGIN { state = 0; }
/RE₁/ { x = $1; state++; }
/RE₂/ { y = $3; state++; }
state == 2 { print x, y; state = 0; }
this may not quite what is wanted, but is --- possibly ---
close to what is intended?
cheers!
-blf-
--
«How many surrealists does it take to | Brian Foster Montpellier,
change a lightbulb? Three. One calms | blf at utvinternet.ie France
the warthog, and two fill the bathtub | Stop E$$o (ExxonMobile)!
with brightly-colored machine tools.» | http://www.stopesso.com
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!