GNU bug report logs - #12115
Please add tip about using tac to reverse a file byte-by-byte

Previous Next

Package: coreutils;

Reported by: Reuben Thomas <rrt <at> sc3d.org>

Date: Wed, 1 Aug 2012 21:46:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #26 received at 12115 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 12115 <at> debbugs.gnu.org, Reuben Thomas <rrt <at> sc3d.org>
Subject: Re: 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 <jim <at> meyering.net> writes:
>
>> Andreas Schwab wrote:
>>> Jim Meyering <jim <at> meyering.net> 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$




This bug report was last modified 12 years and 114 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.