On 4/5/21 1:06 AM, Bruno Haible wrote:
> Alpine Linux does not have the 'join' program.
> The GCS [1] don't list it among the essential utilities.

FWIW: join(1) is required by POSIX [1]:

[1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/join.html

> So, what kind of replacement for it would you recommend?
> My use-case is
> 
>   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

To be honest, I'm not sure whether the variable assignment on the command line
or getline in a BEGIN block is more portable.

Have a nice day,
Berny

Reply via email to