Bash print line if column value is in column of another file

In this article let’s discuss about Bash print line if column value is in column of another file. Let’s go through the following methods without any delay.

Method 1:

# Example usage:
awk 'FNR==NR{a[$1]=$1; next}; $8 in a {print $0;}' input_file_1 input_file_2
# This command prints rows from input_file_2 if the value in a specific
#	field of input_file_2 is found in a specific column of input_file_1.
#	With these specific numbers, this function prints the row from 
#	input_file_2 if the value in column 8 is present in column 1 of 
#	input_file_1.

Hope the above solution works.

Realted Posts : How to open appimage on arch