I have a text file output with the following format:
Line[0]: ('["\'AA\'"]', '["\'BB\'"]', '["\'CC\'"]')
Line[1]: ('["\'XYZ\'"]', '["\'YY\'"]', '["\'ZZ\'"]')
Line[2]: ('["\'PP\'"]', '["\'QQ\'"]', '["\'RR\'"]')
Line[3]: ('["\'XYZ\'"]', '["\'YY\'"]', '["\'ZZ\'"]')
Line[4]: ('["\'PP\'"]', '["\'QQ\'"]', '["\'RR\'"]')
Line[5]: ('["\'PP\'"]', '["\'QQ\'"]', '["\'RR\'"]')
Line[6]: ('["\'AA\'"]', '["\'BB\'"]', '["\'CC\'"]')
Line[7]: ('["\'XYZ\'"]', '["\'YY\'"]', '["\'ZZ\'"]')
I would like to find the duplicate strings in parenthesis, count the repetitive ones and sort them in descending order eliminating the redundant ones. I tried looking in for similar posts that describe using the counter method, but was not able to use in this context. I would like my output to be as described below:
The Line[Num]
are also part of the text file
Expected output:
Line[0]: ('["\'XYZ\'"]', '["\'YY\'"]', '["\'ZZ\'"]') Count=3
Line[1]: ('["\'PP\'"]', '["\'QQ\'"]', '["\'RR\'"]') Count =3
Line[2]: ('["\'AA\'"]', '["\'BB\'"]', '["\'CC\'"]') Count= 2