nmh-workers
[Top] [All Lists]

Re: anno -nodate -component subject -text "hi foo"$'\n'" bar"$'\n'" baz" << Thanks Ralph.

2021-07-17 06:34:52
On Sat 7/17/21 12:26 +0100 Ralph Corderoy wrote:
Hi Tom,

Consider

    $ anno -nodate -component subject -text "hi foo"$'\n'"  bar"$'\n'"  baz"

I was hoping above would add only one subject header. Is there a way to
do that?

No, I don't think so.

http://git.savannah.nongnu.org/cgit/nmh.git/tree/uip/annosbr.c#n377
shows -text's argument being written to the field, preceded by the field
name, once for each line-feed-separated chunk.

You could cheat and consider if you know a character won't occur in the
file which you could use as a placeholder for the line feed.

   $ echo a: 1 >1
   $ anno -nodate -component subject -text $'hi foo\r bar\r xyzzy' +. 1
   $ sed -n l 1
   subject: hi foo\r bar\r xyzzy$
   a: 1$
   $
   $ sed -i 's/\r/\n/g' 1
   $ sed -n l 1
   subject: hi foo$
    bar$
    xyzzy$
   a: 1$
   $

Thanks Ralph. I may add in a work around like yours.

--
Tom

<Prev in Thread] Current Thread [Next in Thread>