[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sed and limited record length
From: |
Ralf Wildenhues |
Subject: |
Re: sed and limited record length |
Date: |
Mon, 22 May 2006 12:30:35 +0200 |
User-agent: |
Mutt/1.5.11 |
Hi Gary,
Just addressing this now:
* Gary V. Vaughan wrote on Mon, May 22, 2006 at 11:45:01AM CEST:
> Ralf Wildenhues wrote:
>
> >I intend to find out whether $NL2SP really is sufficient,
> >or all of those should be
> > ($NL2SP; echo)
> >instead, to ensure a final newline.
>
> easier to write:
>
> foo=`echo X"$bar " | $SP2NL | $Xsed -e baz | $NL2SP`
Erm, after
echo X"$bar "
the data ends with space-newline, after
| $SP2NL
that will be newline-newline, after
| $Xsed -e baz
that will still be the case, after
| $NL2SP
it will be space-space. Then, the shell is to rip off the final
newline, if any. My point is that some shells may be confused iff
there is no final newline. That's what the ($NL2SP; echo) would be for.
I simply don't know whether that is necessary for some broken shells.
Cheers,
Ralf