bug-coreutils
[Top][All Lists]
Advanced

[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: Eric Blake
Subject: bug#12115: Please add tip about using tac to reverse a file byte-by-byte
Date: Fri, 01 Feb 2013 15:04:22 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 02/01/2013 02:43 PM, Reuben Thomas wrote:
> On 1 February 2013 21:36, Paul Eggert <address@hidden> wrote:
> 
>> On 02/01/13 11:14, Reuben Thomas wrote:
>>
>>> Given how long it took how many experts to come up with a valid
>>> incantation, it seems to me it *is* a useful documentation example.
>>
>> Sure, but the valid incantation is a bit confusing, and it's not
>> documented correctly (it reverses characters, not bytes).
>> As far as I know there's no portable way to use 'tac' to
>> reverse a file byte-by-byte.

Use LC_ALL=C to force single-byte characters.

>>
> 
> Thanks!
> 
> What about a way to do it on a GNU system? It seems reasonable to document
> GNU-specific hacks in GNU documentation when a portable solution is not
> forthcoming.

tac is a GNU program not standardized elsewhere, so if you have tac, it
is likely GNU tac to begin with.

The manual already contains:

@example
# Reverse a file character by character.
tac -r -s 'x\|[^x]'
@end example

Do we need a further example, or just modify that existing example to
call out the use of LC_ALL=C for reversing by bytes instead of characters?

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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