12/2 What's a quick way to find the length of the longest line in a file?
\_ perl -p -e'print length $_; s/.*//' <file> |sort -n|tail -1
\_ perl -pe 's/.*/length/e'
\_ perl -pe 's/.*/length $_/e'
\_ perl -lpe '$_=length'
however this automatically chomps the trailing newline, so
you'll need to add 1 to the result if you care about them.
-geordan
\_ what does the l do? which perldoc describes cmdline args?
\_ man perlrun
\_ awk '{print length}'
\_ awk '{L=L>length?L:length}END{print L}' <FILE>
\_ perl -pe 's/.*/length $_/e'
-geordan
no sort or tail needed. beat that! |