C:\Users\Bill\forums\monks>type abc.txt ID1 ABC12 ABC12 - ABC12 - ABC12 ID2 XYZ11 - - - XYZ11 - ID3 - - EFG21 EFG21 - EFG21 ID1072 - PQR34 PQR34 - PQR34 - C:\Users\Bill\forums\monks>type mao9856.pl #!perl -n use strict; use warnings; my @files = split; print shift @files, "\n"; my %uniq; $uniq{$_}++ foreach (@files) ; while (my($name, $count) = each %uniq) { print " ", $name, " ", $count, "\n"; } C:\Users\Bill\forums\monks>perl mao9856.pl abc.txt ID1 - 2 ABC12 4 ID2 XYZ11 2 - 4 ID3 - 3 EFG21 3 ID1072 PQR34 3 - 3
In reply to Re: print first column, unique word in each row along with number times that word is repeated in each row
by BillKSmith
in thread print first column, unique word in each row along with number times that word is repeated in each row
by mao9856
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |