Search Results

Search: Posts Made By: vamsekumar
3,893
Posted By Franklin52
This should be more efficient: awk -F"[# ]"...
This should be more efficient:
awk -F"[# ]" 'NR==FNR{a[$1]=$1;next}$NF in a {print $1, $2, a[$NF]}' list.txt testfile.txt
3,893
Posted By SriniShoo
Your example said you need $1, $2 from test file...
Your example said you need $1, $2 from test file and $0 from list file and I have provided the code for the same.

If you want to print $3 as well from test file
awk 'NR==FNR{a[$0]; next} {for(x...
3,893
Posted By SriniShoo
awk 'NR==FNR{a[$0]; next} {for(x in a) {if($0 ~...
awk 'NR==FNR{a[$0]; next} {for(x in a) {if($0 ~ x) {print $1, $2, x}}}' FS='#' list.txt testfile.txt
Showing results 1 to 3 of 3

 
All times are GMT -4. The time now is 03:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy