Hi
My file have 7 column, FIle is pipe delimed
Col1|Col2|col3|Col4|col5|Col6|Col7
I want to find out uniq record count on col3, col4 and col2 ( same order) how can I achieve it.
ex
1|3|A|V|C|1|1
1|3|A|V|C|1|1
1|4|A|V|C|1|1
Output should be
FREQ|A|V|3|2
FREQ|A|V|4|1
Here last column is count.
zaxxon
2
$ awk -F\| '{_[$3 FS $4 FS $2]++} END{for(e in _){print "FREQ" FS e FS _[e]}}' infile
FREQ|A|V|3|2
FREQ|A|V|4|1
1 Like
awk -F"|" 'BEGIN{i=1}(!a[$3"|"$4"|"$2]){a[$3"|"$4"|"$2]=1;b=$3"|"$4"|"$2;i++;next}{a[$3"|"$4"|"$2]++}
END{for(j=1;j<i;j++) print "FREQ|"b[j]"|"a[b[j]]}' inputfile
msabhi
4
awk -F\| '{a[$3"|"$4"|"$2]++;} END{for(i in a){print "FREQ|"i"|"a;}}' file_name
binlib
5
awk 'BEGIN{SUBSEP=OFS=FS="|"}
{++a[$3,$4,$2]}
END{for(i in a)print "FREQ",i,a}'