I have a large, sorted, CSV file arranged along these lines:
Desk,Left-Drawer,Paperclips Desk,Left-Drawer,Pens Desk,Right-Drawer,Ruler Filing-Cabinet,Top-Drawer,Files
To make it more human-readable, I would like to pretty-print it so that column entries are omitted if they duplicate the one above. The desired output would be something like this:
Desk | Left-Drawer | Paperclips | | Pens | Right-Drawer | Ruler Filing-Cabinet | Top-Drawer | Files
One way of doing this would be to build the table line-by-line, testing if $column_one_value == $last_column_one_value and blanking it if necessary. However, as the number of columns increases, this becomes increasingly ugly.
I was therefore wondering if there were any modules which would help? I’ve been looking through Text::ASCIITable, Text::Table and the like and several of the List ones, but without success. Does anyone know of a nicer way of doing this than looping through and testing for previous values?
Many thanks!
In reply to Pretty-Print Table (Omitting Duplicates) by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |