awk filter with a file

Asocial Reviling answered on May 31, 2023 Popularity 3/10 Helpfulness 9/10

Contents


More Related Answers


awk filter with a file

3

Using the field $NF of other file to filter on the main file

FNR==NR { ... } is a commonly used construct that returns true for only the first file in the arguments list. In this case, awk will read the file other first. When this file is being processed, the value in the last column ($NF) is added to an array (which we have called x). Next then skips processing the rest of our code and begin processing the remainder of the code which is applied to the second file in the arguments list, main. ($NF in x) will print the line if $NF is not in the array.

Popularity 3/10 Helpfulness 9/10 Language shell
Link to this answer
Share Copy Link
Contributed on May 31 2023
Asocial Reviling
0 Answers  Avg Quality 2/10


X

Continue with Google

By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
X
Grepper Account Login Required

Oops, You will need to install Grepper and log-in to perform this action.