I have 2 file,
first file.txt
tskvdsc95
tosaocs
second file.txt
crbvdsc85;172.31.216.65&172.31.216.66;2016;tskvdsc95;172.31.240.65&172.31.240.66;3016
crbvdsc85;172.31.216.65&172.31.216.66;2017;tskvdsc95;172.31.240.65&172.31.240.66;3017
tskvdsc195.epc.mnc009.mcc510.3gppnetwork.org;172.20.197.3;3412;tosaocs;172.20.237.70;3412
tskvdsc195.epc.mnc009.mcc510.3gppnetwork.org;172.20.197.3;3413;tosaocs;172.20.237.69;3413
I need to query 5th column in second file, use data in first file as input for 4th column reference.
bellow is my script
#!/bin/bash
input="/path/to/folder/first file.txt.txt"
while IFS= read -r line
do
awk 'BEGIN{FS=";"} $4=="$line" {print$5}' /path/to/folder/second file.txt | sort | uniq -c
#echo "$line"
done < "$input"
my script is running with empty result not as I am expected.
my expected result should be:
172.31.240.65&172.31.240.66
172.20.237.70
172.20.237.69
please help which part is wrong in above script.
thanks in advance,
WF