Search Results

Search: Posts Made By: mdkm
5,975
Posted By Scrutinizer
OK, I see. Try with $0 : awk 'NR==FNR{C[$0]=0;...
OK, I see. Try with $0 :
awk 'NR==FNR{C[$0]=0; next}{for (i=1; i<=NF; i++) if ($i in C) C[$i]++} END{for(i in C) print i, C[i]}' file1 FS=\| file2
5,975
Posted By RavinderSingh13
Hello, Following may help in same. ...
Hello,

Following may help in same.


awk 'NR==FNR{a[$1]=$1;next} {for(i=1;i<=NF;i++){if($i == a[$i]){v[$i]++}}} END{for(l in v){print l OFS v[l]}}' file FS="|" file2


Output will be as...
5,975
Posted By SriniShoo
awk 'NR == FNR {a[$1]; next} {for(x in a) {if($0...
awk 'NR == FNR {a[$1]; next} {for(x in a) {if($0 ~ "(^||)" x "(||$)") {a[x]++; next}}} END {for(x in a) print x, a[x]}' file1 file2
5,975
Posted By Scrutinizer
I would use a slightly different approach ...
I would use a slightly different approach

awk 'NR==FNR{C[$1]=0; next}{for (i=1; i<=NF; i++) if ($i in C) C[$i]++} END{for(i in C) print i, C[i]}' file1 FS=\| file2

You could also do it the...
Showing results 1 to 4 of 4

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