From: Bruno Haible <bruno@clisp.org>
To: Bernhard Voelker <mail@bernhard-voelker.de>
Cc: bug-gnulib@gnu.org
Subject: Re: replacement for 'join'?
Date: Tue, 06 Apr 2021 03:01:56 +0200 [thread overview]
Message-ID: <4047831.tr10h9zKrZ@omega> (raw)
In-Reply-To: <dc1cd39e-9b56-3f46-a00d-69b06e763809@bernhard-voelker.de>
Hi Berny,
> > join -v 1 FILE1 FILE2
>
> Maybe awk?
>
> $ awk -v keyfile=file2 '
> BEGIN { while ((getline < keyfile) > 0) k[$1]=1 }
> !k[$1]
> ' file1
> or
>
> $ awk '
> keys { k[$1]=1; next }
> !k[$1]
> ' keys=1 file2 keys=0 file1
Wonderful! Thank you. Both solutions work fine with the 'awk' on Alpine Linux
(BusyBox v1.32.1).
> To be honest, I'm not sure whether the variable assignment on the command line
> or getline in a BEGIN block is more portable.
As Alpine Linux is the only platform that lacks 'join', awk portability is
not an issue (so far).
Bruno
next prev parent reply other threads:[~2021-04-06 1:02 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-04 23:06 replacement for 'join'? Bruno Haible
2021-04-05 22:48 ` Bernhard Voelker
2021-04-06 1:01 ` Bruno Haible [this message]
2021-04-06 2:24 ` Paul Eggert
2021-04-06 9:40 ` Bernhard Voelker
2021-04-06 18:47 ` Paul Eggert
2021-04-06 20:45 ` Bruno Haible
2021-04-07 12:04 ` Bernhard Voelker
2021-04-07 12:42 ` Bruno Haible
2021-05-12 10:01 ` Simon Josefsson via Gnulib discussion list
2021-05-12 10:39 ` Bruno Haible
2021-05-12 17:58 ` Simon Josefsson via Gnulib discussion list
2021-05-14 13:17 ` Bernhard Voelker
2021-05-14 13:42 ` Bruno Haible
2021-05-14 13:48 ` Simon Josefsson via Gnulib discussion list
2021-05-14 16:19 ` Bruno Haible
2021-05-14 17:15 ` Bernhard Voelker
2021-05-14 17:42 ` Simon Josefsson via Gnulib discussion list
2021-05-14 19:04 ` Bernhard Voelker
2021-05-14 20:22 ` gnulib-ci project Bruno Haible
2021-05-14 20:36 ` Simon Josefsson via Gnulib discussion list
2021-05-14 21:38 ` Bruno Haible
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4047831.tr10h9zKrZ@omega \
--to=bruno@clisp.org \
--cc=bug-gnulib@gnu.org \
--cc=mail@bernhard-voelker.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).