[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Program for quoting text like in email?



>>> How about passing the text through fmt -w 80|sed 's/^/> //'?
>>> (Untested). That should do what you desire, as fmt would format the
>>> paragraphs, and sed would substitute every beginning of line with a ">
>>> ".
>>
>> I got this output:
>>
>> tommy@todu:~/code$ cat test.txt | fmt -w 80|sed 's/^/> //'
>> sed: -e expression #1, char 8: unknown option to `s'
>> tommy@todu:~/code$
>
> OK, so I guess it should be sed 's/^/> /'. Anyway, experiment this
> method too, sometime. It's fun to know the possibilities with sed, awk
> and friends.

Removing the extra "/" character made it work. I suppose the "Shut up
or I'll replace you with a simple shell script" saying still applies
even to me, but even worse; I could be replaced by a simple /oneliner/
hehe ;).

However I noticed another problem. When I quote a text that is already
quoted, the result gets the "> " characters moved around. I would like
to get ">> " or "> > " for text that is quoted twice. Is that easy to
fix or would that complicate the solution a lot? I tried both the
quoter.pl script and the sed oneliner but none of them could handle
the extra ">" character. I suppose the awk script should have the same
limitation due to my initial question. Hmm.. Any ideas? I'll try to
install the old "pine" email client and see if I could use it by
cut-n-pasting the text, choose reply, and then cut-n-paste it back
again. Not a very elegant solution I admit. But it will have to do
until I (or you ;)) think of a better one. The step after that would
be to try the mutt client if pine fails. Thankful for any ideas.

-- 
Regards,

Thomas Anderson
"Quidquid latine dictum sit, altum sonatur"


Reply to: