Search Results

Search: Posts Made By: dragonfly85
1,638
Posted By RudiC
awk ' {VT = $NF ...
awk '
{VT = $NF # Extract last field into Value Temp variable
sub (FS "*" VT "$", _) ...
1,638
Posted By RudiC
Making the assumption you want to compare line by...
Making the assumption you want to compare line by line, and ignoring the special case of equal values, I come up with
awk '
{VT = $NF
sub (FS "*" VT "$", _)
...
1,097
Posted By vgersh99
awk -F,...
awk -F, '{gsub("[^-+0-9.,]","",$(NF-2));s+=$(NF-2)}END{print s}' myFile
1,078
Posted By RudiC
Single grep approach: sed 's/^/^/' filea | grep...
Single grep approach:
sed 's/^/^/' filea | grep -of- fileb | sort | uniq -c
1 39
2 44You can drop the sort if fileb is already sorted.
1,078
Posted By MadeInGermany
Supress showing the zero matches: while read cc...
Supress showing the zero matches:
while read cc
do
c=$(grep -c "^$cc" fileb) &&
echo "$cc - $c times"
done <filea
...
END {for (i in a) if (a[i]) printf("%d - %d times\n", i, a[i])}
'...
1,078
Posted By vgersh99
or: awk 'FNR==NR {a[$1];next} {for(i in a)...
or:

awk 'FNR==NR {a[$1];next} {for(i in a) if ($0 ~ ("^"i)) a[i]++}END {for (i in a) printf("%d - %d times\n", i, a[i])}' fileA fileB
1,078
Posted By jgt
The lazy way if you just have to run it once. ...
The lazy way if you just have to run it once.

while read cc
do
echo $cc $(grep -c "^$cc" fileb)
done <filea


If you have to run this frequently, or the number of records in filea is...
Showing results 1 to 7 of 7

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