[ale] Utility to word-wrap plain text?
Cox, Danny
dcox at icc.net
Thu Mar 29 08:12:02 EDT 2007
Chuck,
That worked, too. Actually
fold -s -w 72
worked.
With that said, however, the sed is still required because the contents
of the
text area contain CR's (0x0d, '\r'). Without translating those to LF's
(0x0a), neither fold nor fmt recognize \r end of line. So the command
becomes:
echo "${FORM_message}" | sed -e 's/^M/\n/g' | fold -s -w 72
where the "^M" is a single character entered as a Ctrl-V Ctrl-M in vim.
(Using
\r does NOT work on the regex side of sed's substitute command.
A slightly simpler and less resource intensive program to use
instead of sed would be tr:
echo "${FORM_message}" | tr '\r' '\n' | fold -s -w 72
but only slightly. I only mentioned it because (in my
not-so-humble-opinion) it fits this application better then sed (e.g. no
REs).
Danny
More information about the Ale
mailing list