[Top][All Lists]

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

Re: multiline output variables.

From: Noah Misch
Subject: Re: multiline output variables.
Date: Mon, 17 Jan 2005 13:37:03 -0800
User-agent: Mutt/1.5.6i

On Mon, Jan 17, 2005 at 11:13:11AM +0100, Stepan Kasal wrote:
> On Fri, Jan 14, 2005 at 02:56:16AM -0800, Noah Misch wrote:
> > s/[^t]$/&\\/ does not do the job?
> I don't think so.  What if the substituted value were "first\nsecond"?
> The newline wouldn't get escaped.

Oops.  I stopped thinking far too quickly.  Thanks.

> I think that if we choose a sufficiently unusual delimiter, we can go with
> it.  I suggest that we use the delimiter "@!_!#_ \n" (the last two characters
> are space and newline).

That is much better.

If you wanted to avoid excluding any delimiter, you do something like this:

for ac_var in var1 var2 ... varN
    eval "case \$$ac_var in
'*)       filter=' | sed '\\''\$q;s/\$/\\\\/'\\' ;;
       *) filter= ;;
    eval echo \"s,@$ac_var@,\$$ac_var,\;t t\" $filter
done | existing_cleanup_seds

reply via email to

[Prev in Thread] Current Thread [Next in Thread]