Sometimes I want to find the longest string under a particular column within a rather large, unsorted CSV file (several GB).
This can be useful to know for specifying sane database column size restrictions, etc. I've also found myself doing variations on this theme - wanting to do a quick and dirty comparison or operation based on an attribute of a particular column or columns in a delimited file.
Typically I'll do something like this:
perl -F, -lane 'print $t = length $F[0] <= $t ? next LINE : length $F[0]' file.csvJust wondering if anyone has a cleaner one-liner to accomplish this. There's got to be a sexier way. Or maybe just a more efficient way. Any ideas?
In reply to Delimited File Analysis One-Liner? by temporal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |