[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: replacement for 'join'?

From: Paul Eggert
Subject: Re: replacement for 'join'?
Date: Tue, 6 Apr 2021 11:47:10 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1

On 4/6/21 2:40 AM, Bernhard Voelker wrote:
grep -Fvf file2 file1
I started with that, too, but it is problematic because:
a) it doesn't do a whole-word search ... and 'grep -w' seems not to be portable,
b) it doesn't limit the matching on the key field.
And messing with regular expressions seems to be fragile as well, because the
key field may contain problematic characters.

Yes, 'awk' is the way to go if you want more 'join' capability (not just treating the entire line as the key). But if the data are not large and each key takes up the whole line, 'grep' should work fine.

Regular expressions are not a problem, as the -F option disables them.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]