Search Results

Search: Posts Made By: irrevocabile
2,955
Posted By vgersh99
nawk 'FNR==NR{a[$1];next}{for(i in a) print i,...
nawk 'FNR==NR{a[$1];next}{for(i in a) print i, $2}' myFile myFile
8,725
Posted By radoulov
If you're on Solaris, use nawk or...
If you're on Solaris, use nawk or /usr/xpg4/bin/awk:

awk 'END {
for (i = 0; ++i <= NF;)
printf "%s", (m[i] (i < NF ? FS : RS))
}
{
for (i = 0; ++i <= NF;)
$i > m[i] && m[i] =...
12,222
Posted By Chubler_XL
It probably does need some explination. ...
It probably does need some explination.

Consider the following input
The quick brown fox jumped over the lazy
brown fox.

It produces to 2 arrays from this g is a global word count:...
12,222
Posted By Chubler_XL
Well spotted - my test data didn't have a line...
Well spotted - my test data didn't have a line with zero count, fixed below.
Also matches words regardless of their case and removes common punctuantion (eg comma, full stop, semi-colon, colon,...
12,222
Posted By alister
I did not run the code, only skimmed it, but it...
I did not run the code, only skimmed it, but it seems to me that if a word that meets the frequency threshold does not occur in a line, the printf statement will not print a 0. I'm assuming a 0...
12,222
Posted By yinyuemi
Thanks Chubler_XL, based on your note, I have my...
Thanks Chubler_XL, based on your note, I have my code a little change to be more robust,
awk 'NR==FNR{for(i=1;i<=NF;i++) {a[$i]++}}
NR>FNR&&FNR==1{for(i in a) {if( a[i]>=1) b[j++]=i;printf i "...
Showing results 1 to 6 of 6

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