bug#12115: Please add tip about using tac to reverse a file byte-by-byte
From:
Jim Meyering
Subject:
bug#12115: Please add tip about using tac to reverse a file byte-by-byte
Date:
Thu, 02 Aug 2012 14:07:39 +0200
Andreas Schwab wrote:
> Jim Meyering <address@hidden> writes:
>
>> Andreas Schwab wrote:
>>> Jim Meyering <address@hidden> writes:
>>>
>>>> (note that below there's the added advantage of not having to
>>>> double-quote to include $nl and hence not having to double-backslash)
>>>
>>> You can have that with the variable as well.
>>
>> You're right. We could write it like this:
>>
>> printf '\na\nb'|tac -rs '.\|'$nl
>
> No, you need the quotes around $nl.
You need the double quotes around $nl with bash,
but not with zsh:
zsh$ nl='
quote> '
zsh$ printf %s $nl
zsh$