22 Mar 2005 15:01

Truncate at 72 characters with sed

I like to make cron jobs to mail me interesting information, e.g. the output of clog. Often, I want to truncate at 72 characters rather than deal with the wrapping, so I use this cute little sed script:

sed "s/^\(.\{72\}\).*$/\1/"