[ale] Utility to word-wrap plain text?

Chuck Huber chuck at cehuber.org
Wed Mar 28 18:56:53 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> Message: 4
> Date: Wed, 28 Mar 2007 15:42:02 -0400
> From: "Stephen R. Blevins" <srblevi at worldnet.att.net>
> Subject: Re: [ale] Utility to word-wrap plain text?
> To: Atlanta Linux Enthusiasts <ale at ale.org>
> Message-ID: <460AC50A.1060108 at worldnet.att.net>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> What about this?  [Looks cleaner to me]
> 
> 	echo "${FORM_message}" | fold -s -w-=72

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.

BTW, I posted the proccgi command wrong earlier.  It should have been:

    eval `proccgi $*`

proccgi does a pretty good job at converting form field names and values to
shell variables.  It works with both POST and GET methods.  Take a look at

    http://www.fpx.de/fp/Software/proccgi.c
    http://nleaudio.com/bnotes/proccgi.c

The latter has been modified to convert '-' in form field names to '_'.

Enjoy,
    - Chuck
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGCvK1iR3HaLbYCa4RAhl+AKDk4frIteALxqjMbDf7M5mxM2TdmACdGD3Q
4hio042Yal4ieytUxmwQ/Z4=
=42qW
-----END PGP SIGNATURE-----



More information about the Ale mailing list