5/6 How do I use sed to truncate output lines to say 60char/columns?
\- helo "man cut" ok tnx. --psb
\_ command | cut -c1-60
\_ will truncate, yes, but not useful for wrapping the text.
\_ Was text-wrapping requested? No.
\_ Um.. if you wanted line wrapping, use fmt.
\_ perl is the answer to all text modifying or extraction questions.
\_ Ok fine. How do I do this in perl?
\_ command | perl -n -e 'print substr $_,0,60,"\n";' though
I suspect this would be trivial with sed.--scotsman
\_ command | perl -pe 's/^(.{1,60}).*$/\1/;'
\_ Try "fold".
\_ Try "fmt".
\_ Try ED! and counting out to the 60th character on each line and
deleting everything after it. Save the file out to a different
file name if you need the original. |