[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] File partial overwrite when using join
From: |
David Niklas |
Subject: |
Re: [bug-gawk] File partial overwrite when using join |
Date: |
Fri, 19 Feb 2016 18:41:15 -0500 |
On Fri, 5 Feb 2016 17:51:13 Wolfgang Laun wrote:
> gawk is not to be blamed.
>
> join requires the files to be sorted on the "key" field.
>
> Cheers
> Wolfgang
>
>
> On 4 February 2016 at 06:56, <address@hidden> wrote:
>
> > This is part of an Gawk program I wrote to find new ebuilds (Gentoo
> > equivalent of rpm spec) on an as wanted basis vs using esync and
> > having to check for them immediately.
> > I left all debug and return checking code in so you can see what
> > happens. I'm not certain if this odd behaviour is due to Gawk or join
> > or something else.
> > What happens is this:
> > You run the awk program and instead of printing out:
> >
> > 1 NEW PACKAGES
> > app/zaz [ masked ]
> > 2 REMOVED PACKAGES
> > app/bar
> >
> > You get:
> >
> > 1 NEW PACKAGES
> > 2 REMOVED PACKAGES
> > app/bar
> >
> > Technically you get more output then that, but that'd because this
> > little snippet is trying to be informative. If you uncomment the
> > marked line the case gets even weirder as Gawk overwrites instead of
> > appending to the file. I tried using sync and fflush to no avail.
> > I've attacked all three files so you can try it yourself. You'll
> > need to change the dir variable to reflect your own environment.
> > I also tried nawk but it did the same thing.
<snip>
I just retried the code after running sort file | sponge file, the
problem persists.
I then removed the second field in each file (so now there's only one
field), still no go.
Thanks, David