Hello, Manju Moorthy, and welcome to the Monastery.
You could do this in Perl but is there any need when
$ sort file | uniq -cwould seem to be all you require? Just for fun here's a Perl equivalent
$ perl -ne '$x{$_}++;END {printf ("%5i %s", $x{$_}, $_) for keys %x};' fileIn reply to Re: Comparing each line of a file to itself
by hippo
in thread Comparing each line of a file to itself
by Manju Moorthy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |