Subject: Re: Rewrap "> " lines from file ?
From: rpw3@rpw3.org (Rob Warnock)
Date: Wed, 20 Aug 2008 20:32:47 -0500
Newsgroups: comp.lang.lisp,comp.lang.scheme
Message-ID: <M_KdnYrqUvciWDHVnZ2dnUVZ_iydnZ2d@speakeasy.net>
<problems@gmail> wrote:
+---------------
| I want to promote the idea that 'we should use a higher level langauge,
| like lisp or scheme'.   But I don't yet have enough fluency to give a good
| example.   A suitable and not too big a task, to serve as a comparison
| against the currently used languages would be:
| 
| rearrange a small text file, so that:
| * all lines of length > 78 are wrapped to len < 75, with breaks at 
|     word-boundries;
| * the "> " strings which start each line are replaced to the beginning
|   of the new shorter lines;
+---------------

As much as I like Lisp, this tiny task simply cries out
for a "one-liner" shell script!

     sed -s 's/^> //' ${1+"$@"} | fmt -75 |  sed -s 's/^/> /'


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607