Re: filtering for identical field labels



On 30 Nov., 15:47, Al <palcibiades-fi...@xxxxxxxxxxx> wrote:
Janis wrote:
/^\*\*\*record/ { tags="" }

Initialize the data for a line of output (stored in var tags).

/^#/ { print tags }

Finalize processing of a line output.

/^irrelevant/ { next }

Ignore those lines.

{ sep = (t!=$1 ? (tags=="" ? "" : "\t") : " ") }

Construct the separator between fields on a line;
NULL "" initially at the front of the line,
TAB "\t" in case the stored tag t differs from preceeding tag,
SPACE " " in case the same tag as before occurred.

{ tags = tags sep $2 ; t = $1}

Construct output line and safe tag field $1 in t for comparison.

(BTW, the last two blocks {...} can be joined, of course.)

Janis, thank you enormously for this. It will take me a day or so to
decipher,

You're welcome. Comments added.

Janis

and I now feel deeply glad not to have posted my own stumbling
efforts to do it! To say they were crude and fumbling by comparison is an
understatement.
.



Relevant Pages

  • Re: Help needed for a expand-collapse menu
    ... function getParentByTag(element, tag) { ... var div = getParentByTag; ... if (!div) return; // Fail silently ... so I need help with the collapse part and this is how I would like to ...
    (comp.lang.javascript)
  • Re: Inherited Methods and such
    ... which was called from Initialize. ... set the tag to the real tag. ... I think forbidding "calling out" is going too far. ... inside a task body, not inside a procedure called by the task body.) ...
    (comp.lang.ada)
  • Re: Pop Up bookmark in hotspot
    ... Remove All the code you pasted in the hyperlink tag and paste it in the HEAD section as ... var title="YOURWEBSITE DESCRIPTION "; ... | the little box that says "Bookmark this Page" and then opens up the viewer's ... | | the answers I got were good - however when I draw the hotspot in the ...
    (microsoft.public.frontpage.client)
  • Re: Get ID-Tags of MP3s
    ... {- Fixed bug with tag ... {ID3v2 frame header} ... function ExtractTrack(const TrackString: string): Byte; ...
    (comp.lang.pascal.delphi.misc)
  • Re: Get ID-Tags of MP3s
    ... {- Fixed bug with tag ... {ID3v2 frame header} ... function ExtractTrack(const TrackString: string): Byte; ...
    (alt.comp.lang.borland-delphi)