in reply to Re^2: Find duplicate lines from the file and write it into new file.
in thread Find duplicate lines from the file and write it into new file.

I used the script to find duplicate rows in my log file and it worked well. Thanks! However, it would be great if this script could be updated to display how may times the rows have been repeated as well. Please help!
  • Comment on Re^3: Find duplicate lines from the file and write it into new file.

Replies are listed 'Best First'.
Re^4: Find duplicate lines from the file and write it into new file.
by choroba (Cardinal) on Jun 28, 2011 at 09:17 UTC
    Pretty easy, the numbers are stored in the hash already. Just remove the print and add the following at the end of the script:
    print "$duplicates{$_}\t$_" for grep $duplicates{$_} > 1,keys %duplica +tes;