[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
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 09:22:55 +0200 |
Reuben Thomas wrote:
...
> +To reverse a file byte by byte, use:
> +
> address@hidden
> +tac -r -s '.\| ' @var{file}
> address@hidden example
> +
Thanks!
That's a good demonstration.
Please note that it's not efficient and include the perl one-liner
for reference.
Here's a portable way to include the newline correction Eric mentioned:
nl='
'
tac -r -s ".\\|$nl" @var{file}
I would add that with a shell like bash or zsh you can do it more cleanly,
using $'\n' in place of the shell variable:
(note that below there's the added advantage of not having to
double-quote to include $nl and hence not having to double-backslash)
tac -r -s '.\|'$'\n' @var{file}
- bug#12115: Please add tip about using tac to reverse a file byte-by-byte, Reuben Thomas, 2012/08/01
- bug#12115: Please add tip about using tac to reverse a file byte-by-byte, Eric Blake, 2012/08/01
- bug#12115: Please add tip about using tac to reverse a file byte-by-byte,
Jim Meyering <=
- bug#12115: Please add tip about using tac to reverse a file byte-by-byte, Andreas Schwab, 2012/08/02
- bug#12115: Please add tip about using tac to reverse a file byte-by-byte, Jim Meyering, 2012/08/02
- bug#12115: Please add tip about using tac to reverse a file byte-by-byte, Andreas Schwab, 2012/08/02
- bug#12115: Please add tip about using tac to reverse a file byte-by-byte, Jim Meyering, 2012/08/02
- bug#12115: Please add tip about using tac to reverse a file byte-by-byte, Voelker, Bernhard, 2012/08/02
- bug#12115: Please add tip about using tac to reverse a file byte-by-byte, Andreas Schwab, 2012/08/02
- bug#12115: Please add tip about using tac to reverse a file byte-by-byte, Eric Blake, 2012/08/02
- bug#12115: Please add tip about using tac to reverse a file byte-by-byte, Andreas Schwab, 2012/08/02
- bug#12115: Please add tip about using tac to reverse a file byte-by-byte, Reuben Thomas, 2012/08/02