Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

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

# 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.
 
PREVIOUS NEXT
Tagged: #bash #print #line #column #column #file
ADD COMMENT
Topic
Name
9+3 =