From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 01 17:45:21 2012 Received: (at submit) by debbugs.gnu.org; 1 Aug 2012 21:45:21 +0000 Received: from localhost ([127.0.0.1]:55437 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SwgjH-0005vW-Sy for submit@debbugs.gnu.org; Wed, 01 Aug 2012 17:45:20 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41155) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SwgjE-0005vN-8q for submit@debbugs.gnu.org; Wed, 01 Aug 2012 17:45:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Swgc0-0004OG-Cn for submit@debbugs.gnu.org; Wed, 01 Aug 2012 17:37:49 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:37137) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Swgc0-0004OC-9W for submit@debbugs.gnu.org; Wed, 01 Aug 2012 17:37:48 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60637) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Swgbz-0004Qs-8X for bug-coreutils@gnu.org; Wed, 01 Aug 2012 17:37:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Swgby-0004O0-AM for bug-coreutils@gnu.org; Wed, 01 Aug 2012 17:37:47 -0400 Received: from exprod7og107.obsmtp.com ([64.18.2.167]:52629) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1Swgby-0004Nt-1j for bug-coreutils@gnu.org; Wed, 01 Aug 2012 17:37:46 -0400 Received: from mail-gh0-f182.google.com ([209.85.160.182]) (using TLSv1) by exprod7ob107.postini.com ([64.18.6.12]) with SMTP ID DSNKUBmhp94dAaUMJVQuX9MTj7ss5HsRVO0z@postini.com; Wed, 01 Aug 2012 14:37:45 PDT Received: by ghbz22 with SMTP id z22so11450690ghb.27 for ; Wed, 01 Aug 2012 14:37:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type :x-gm-message-state; bh=5RvgCDzPIN1LS93om5AwAkQqUR+4GgGMSOdcTZ7S8Hw=; b=FjC9BZlM2InrpAk1fZ5KSZLgetaED5/RSD4gEA0VRgHzrRBjfzAnbEfh+4gH4VWCrH YlcVkLlRCFJlYx/QvTeOp8vfYjm9vCwmrQyIdVK8nBRTNBJ0AV5sFDNHBH6YliO0+vZu Bb31vdQCPGpxxIUwQxrGKaF4I0PvmRHhHS3XmPEwsrFjYo3Vr5a5uKsgUsBCp6neF1h6 T7pqkYlsm1fb4ca7wv8zvBO/X6jkPG+CglROVsaSAuGigCtwGZ0nQDGmBVQwdb5SPAK1 kNYRoHiVBfRY8jY6/A+CucnXm6WSaWn1ytBM87EJvF6czwAMkmeFNHGgvAHXN/WPj+NJ FmOw== MIME-Version: 1.0 Received: by 10.50.88.134 with SMTP id bg6mr212461igb.0.1343857062637; Wed, 01 Aug 2012 14:37:42 -0700 (PDT) Received: by 10.231.126.66 with HTTP; Wed, 1 Aug 2012 14:37:42 -0700 (PDT) Date: Wed, 1 Aug 2012 22:37:42 +0100 Message-ID: Subject: Please add tip about using tac to reverse a file byte-by-byte From: Reuben Thomas To: bug-coreutils Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQkgyNSuwty55LPUTTTzdTiEN0CPsw1KALvU8cS7dMpnjMZ5jX9+GaaPhMl5y1b+IJqmZVSZ X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -6.2 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.2 (------) Patch: >From 3c1b7d442dc6161e3c88703c9acc3f768f9ba689 Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Wed, 1 Aug 2012 22:35:38 +0100 Subject: [PATCH] doc: Add tip on reversing a file byte-by-byte * doc/coreutils.texi: Note how to use tac to reverse a file byte-by-byte. --- doc/coreutils.texi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 516ec73..66b0838 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -1625,6 +1625,12 @@ Use @var{separator} as the record separator, instead of newline. @end table +To reverse a file byte by byte, use: + +@example +tac -r -s '.\| ' @var{file} +@end example + @exitstatus -- 1.7.9.5 -- http://rrt.sc3d.org From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 01 17:57:56 2012 Received: (at 12115) by debbugs.gnu.org; 1 Aug 2012 21:57:56 +0000 Received: from localhost ([127.0.0.1]:55450 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SwgvT-0006C5-Tu for submit@debbugs.gnu.org; Wed, 01 Aug 2012 17:57:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34863) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SwgvO-0006Bu-3K for 12115@debbugs.gnu.org; Wed, 01 Aug 2012 17:57:54 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q71LoMtk011283 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 1 Aug 2012 17:50:22 -0400 Received: from [10.3.113.77] (ovpn-113-77.phx2.redhat.com [10.3.113.77]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q71LoLvG004178; Wed, 1 Aug 2012 17:50:21 -0400 Message-ID: <5019A49A.60309@redhat.com> Date: Wed, 01 Aug 2012 15:50:18 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0 MIME-Version: 1.0 To: Reuben Thomas Subject: Re: bug#12115: Please add tip about using tac to reverse a file byte-by-byte References: In-Reply-To: X-Enigmail-Version: 1.4.3 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig0D24EE3268DA65A6141AE482" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: 12115 Cc: 12115@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig0D24EE3268DA65A6141AE482 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 08/01/2012 03:37 PM, Reuben Thomas wrote: > Patch: >=20 >>>From 3c1b7d442dc6161e3c88703c9acc3f768f9ba689 Mon Sep 17 00:00:00 2001 > From: Reuben Thomas > Date: Wed, 1 Aug 2012 22:35:38 +0100 > Subject: [PATCH] doc: Add tip on reversing a file byte-by-byte >=20 > * doc/coreutils.texi: Note how to use tac to reverse a file > byte-by-byte. > --- > doc/coreutils.texi | 6 ++++++ > 1 file changed, 6 insertions(+) >=20 > diff --git a/doc/coreutils.texi b/doc/coreutils.texi > index 516ec73..66b0838 100644 > --- a/doc/coreutils.texi > +++ b/doc/coreutils.texi > @@ -1625,6 +1625,12 @@ Use @var{separator} as the record separator, > instead of newline. >=20 > @end table >=20 > +To reverse a file byte by byte, use: > + > +@example > +tac -r -s '.\| ' @var{file} Cool tip. But not quite accurate - you need a literal newline instead of a space on the other side of that regex alternation. --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enig0D24EE3268DA65A6141AE482 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJQGaScAAoJEKeha0olJ0Nq1d8IAKcUSiF3LkKF15P92IvjJj6A BztkMG9xNQ//6uZ68B7djdSFF7Zgu4iG85ZxQswhINBw0QsnIYq5YcA/27iOx3p1 I3UXZckMBb3AsL0VNn0A73oVtu/aD01JvFtbLLMlN8PLIxN+4TAnO/o3PZmWJW8B rLB7J3LaKqo5a77WY1Kp0o42w04YsqpJ+s+Zr7Lnuzp80G4pQtgwkvGlCH0e+AYz rLeDtO/Gq0GdNJUS8d/+FXW+e6YvmSnPWRnadnUl5qh6Mks7CDep/Nh+s/px+w+e dzA6rnn5JoE2WJLFwRfVlMAjMWJfhlpqxzUyAi+wegnqBSj8yREcDTRA6zjhMxo= =D/EW -----END PGP SIGNATURE----- --------------enig0D24EE3268DA65A6141AE482-- From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 01 18:02:39 2012 Received: (at 12115) by debbugs.gnu.org; 1 Aug 2012 22:02:40 +0000 Received: from localhost ([127.0.0.1]:55455 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Swh03-0006JL-KA for submit@debbugs.gnu.org; Wed, 01 Aug 2012 18:02:39 -0400 Received: from exprod7og114.obsmtp.com ([64.18.2.215]:45963) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1Swh01-0006JE-Kw for 12115@debbugs.gnu.org; Wed, 01 Aug 2012 18:02:39 -0400 Received: from mail-yw0-f53.google.com ([209.85.213.53]) (using TLSv1) by exprod7ob114.postini.com ([64.18.6.12]) with SMTP ID DSNKUBmlvQuxct8rXXysGlQTb+LbKi66EYe2@postini.com; Wed, 01 Aug 2012 14:55:10 PDT Received: by mail-yw0-f53.google.com with SMTP id 26so9583425yhp.26 for <12115@debbugs.gnu.org>; Wed, 01 Aug 2012 14:55:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=ssLlkrNRU+vBFFAxjkLVx8ifs9fLLnclM607fCeWQcc=; b=afUzfwqFGFLaEsOO0m/LmO/A/uoRkQ8e9sn3BnR/gNQ3sopkT5/ECHe2r3ZoeGzeuq dk4OM+XzJHZJno0a+67xjM1i11CtdQwISQzYfBZuU4ysOvnYcTW2gy3GRTHwv7UkgcX4 I4aBi6KUB7/fh0yfusqorh686+UfCPf5inL/tV4GVgMHCcrVhaNqwg+/3y0nJ8mByztn 6pP5/vVCyd63edW5HlhE5VFTrSwvfWI2TthgyjWebEEJbhtsEkZhNxz23iM1yFagDSiW DWi5CNphQPEBN5kmBHP4A/82mOzLYp3zzQ6A7vtStwHakvRulhLvvUox7NH2k1tpK71w rPUg== MIME-Version: 1.0 Received: by 10.50.180.169 with SMTP id dp9mr6651800igc.8.1343858109654; Wed, 01 Aug 2012 14:55:09 -0700 (PDT) Received: by 10.231.126.66 with HTTP; Wed, 1 Aug 2012 14:55:09 -0700 (PDT) In-Reply-To: <5019A49A.60309@redhat.com> References: <5019A49A.60309@redhat.com> Date: Wed, 1 Aug 2012 22:55:09 +0100 Message-ID: Subject: Re: bug#12115: Please add tip about using tac to reverse a file byte-by-byte From: Reuben Thomas To: Eric Blake Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQmgNhKGjvjBpH8a1ioXfA6ejZ1GCybACHcTmji3g7awQz2TD98HVk7AH825oiw8nZ1mk1p4 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 12115 Cc: 12115@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) On 1 August 2012 22:50, Eric Blake wrote: > > Cool tip. But not quite accurate - you need a literal newline instead > of a space on the other side of that regex alternation. Sorry, I just copied what I found at http://stackoverflow.com/questions/6438099/linux-command-line-tool-to-reverse-byte-order-change-endianess without thinking. I see your point. -- http://rrt.sc3d.org From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 02 03:30:27 2012 Received: (at 12115) by debbugs.gnu.org; 2 Aug 2012 07:30:27 +0000 Received: from localhost ([127.0.0.1]:55930 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SwprW-00025K-P4 for submit@debbugs.gnu.org; Thu, 02 Aug 2012 03:30:26 -0400 Received: from mx.meyering.net ([88.168.87.75]:33291) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SwprV-00025D-4R for 12115@debbugs.gnu.org; Thu, 02 Aug 2012 03:30:26 -0400 Received: from rho.meyering.net (rho.meyering.net [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id 39C62601B2; Thu, 2 Aug 2012 09:22:55 +0200 (CEST) From: Jim Meyering To: Reuben Thomas Subject: Re: bug#12115: Please add tip about using tac to reverse a file byte-by-byte In-Reply-To: (Reuben Thomas's message of "Wed, 1 Aug 2012 22:37:42 +0100") References: Date: Thu, 02 Aug 2012 09:22:55 +0200 Message-ID: <87d339ycz4.fsf@rho.meyering.net> Lines: 27 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 12115 Cc: 12115@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Reuben Thomas wrote: ... > +To reverse a file byte by byte, use: > + > +@example > +tac -r -s '.\| ' @var{file} > +@end 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} From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 02 04:18:06 2012 Received: (at 12115) by debbugs.gnu.org; 2 Aug 2012 08:18:06 +0000 Received: from localhost ([127.0.0.1]:56039 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Swqbd-00039s-W8 for submit@debbugs.gnu.org; Thu, 02 Aug 2012 04:18:06 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:56881) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Swqba-00039h-MS for 12115@debbugs.gnu.org; Thu, 02 Aug 2012 04:18:03 -0400 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3WnkbD3JlHz4KK6f; Thu, 2 Aug 2012 10:10:32 +0200 (CEST) X-Auth-Info: ZCKdORKQm/9QakGQ/GmpD9KHR6lpHuYkvnQfDpY4my4= Received: from igel.home (ppp-88-217-102-86.dynamic.mnet-online.de [88.217.102.86]) by mail.mnet-online.de (Postfix) with ESMTPA id 3WnkbD2pDZzbbhv; Thu, 2 Aug 2012 10:10:32 +0200 (CEST) Received: by igel.home (Postfix, from userid 501) id 15F0ECA2A2; Thu, 2 Aug 2012 10:10:32 +0200 (CEST) From: Andreas Schwab To: Jim Meyering Subject: Re: bug#12115: Please add tip about using tac to reverse a file byte-by-byte References: <87d339ycz4.fsf@rho.meyering.net> X-Yow: Uh-oh -- WHY am I suddenly thinking of a VENERABLE religious leader frolicking on a FORT LAUDERDALE weekend? Date: Thu, 02 Aug 2012 10:10:31 +0200 In-Reply-To: <87d339ycz4.fsf@rho.meyering.net> (Jim Meyering's message of "Thu, 02 Aug 2012 09:22:55 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 12115 Cc: 12115@debbugs.gnu.org, Reuben Thomas X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Jim Meyering 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. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 02 04:49:40 2012 Received: (at 12115) by debbugs.gnu.org; 2 Aug 2012 08:49:40 +0000 Received: from localhost ([127.0.0.1]:56077 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Swr6A-0003tk-7G for submit@debbugs.gnu.org; Thu, 02 Aug 2012 04:49:40 -0400 Received: from mx.meyering.net ([88.168.87.75]:33493) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Swr63-0003tW-6M for 12115@debbugs.gnu.org; Thu, 02 Aug 2012 04:49:36 -0400 Received: from rho.meyering.net (rho.meyering.net [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id A7E756011B; Thu, 2 Aug 2012 10:42:00 +0200 (CEST) From: Jim Meyering To: Andreas Schwab Subject: Re: bug#12115: Please add tip about using tac to reverse a file byte-by-byte In-Reply-To: (Andreas Schwab's message of "Thu, 02 Aug 2012 10:10:31 +0200") References: <87d339ycz4.fsf@rho.meyering.net> Date: Thu, 02 Aug 2012 10:42:00 +0200 Message-ID: <87txwlwuqv.fsf@rho.meyering.net> Lines: 17 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 12115 Cc: 12115@debbugs.gnu.org, Reuben Thomas X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Andreas Schwab wrote: > Jim Meyering 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 or even drop the quotes altogether: printf '\na\nb'|tac -rs .\\\|$nl Golf is fun, but those seem less well suited as documentation examples. From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 02 05:38:55 2012 Received: (at 12115) by debbugs.gnu.org; 2 Aug 2012 09:38:55 +0000 Received: from localhost ([127.0.0.1]:56158 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Swrrr-0004zP-HR for submit@debbugs.gnu.org; Thu, 02 Aug 2012 05:38:55 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:54281) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Swrrp-0004zH-4y for 12115@debbugs.gnu.org; Thu, 02 Aug 2012 05:38:54 -0400 Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3WnmNV2wrKz3hhr3; Thu, 2 Aug 2012 11:31:22 +0200 (CEST) X-Auth-Info: mpihw79wr8+ILUX63OjazCrjXXAMaxxwpXWk9uikTsk= Received: from igel.home (ppp-88-217-102-86.dynamic.mnet-online.de [88.217.102.86]) by mail.mnet-online.de (Postfix) with ESMTPA id 3WnmNV1Xplzbbhs; Thu, 2 Aug 2012 11:31:22 +0200 (CEST) Received: by igel.home (Postfix, from userid 501) id DBA85CA2A2; Thu, 2 Aug 2012 11:31:21 +0200 (CEST) From: Andreas Schwab To: Jim Meyering Subject: Re: bug#12115: Please add tip about using tac to reverse a file byte-by-byte References: <87d339ycz4.fsf@rho.meyering.net> <87txwlwuqv.fsf@rho.meyering.net> X-Yow: I'm mentally OVERDRAWN! What's that SIGNPOST up ahead? Where's ROD STERLING when you really need him? Date: Thu, 02 Aug 2012 11:31:21 +0200 In-Reply-To: <87txwlwuqv.fsf@rho.meyering.net> (Jim Meyering's message of "Thu, 02 Aug 2012 10:42:00 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 12115 Cc: 12115@debbugs.gnu.org, Reuben Thomas X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Jim Meyering writes: > Andreas Schwab wrote: >> Jim Meyering 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. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 02 08:15:14 2012 Received: (at 12115) by debbugs.gnu.org; 2 Aug 2012 12:15:14 +0000 Received: from localhost ([127.0.0.1]:56359 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SwuJ7-0000wr-Sy for submit@debbugs.gnu.org; Thu, 02 Aug 2012 08:15:14 -0400 Received: from mx.meyering.net ([88.168.87.75]:34014) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SwuJ4-0000wj-Eq for 12115@debbugs.gnu.org; Thu, 02 Aug 2012 08:15:12 -0400 Received: from rho.meyering.net (rho.meyering.net [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id 6B8FB600FC; Thu, 2 Aug 2012 14:07:39 +0200 (CEST) From: Jim Meyering To: Andreas Schwab Subject: Re: bug#12115: Please add tip about using tac to reverse a file byte-by-byte In-Reply-To: (Andreas Schwab's message of "Thu, 02 Aug 2012 11:31:21 +0200") References: <87d339ycz4.fsf@rho.meyering.net> <87txwlwuqv.fsf@rho.meyering.net> Date: Thu, 02 Aug 2012 14:07:39 +0200 Message-ID: <87k3xhwl84.fsf@rho.meyering.net> Lines: 26 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 12115 Cc: 12115@debbugs.gnu.org, Reuben Thomas X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Andreas Schwab wrote: > Jim Meyering writes: > >> Andreas Schwab wrote: >>> Jim Meyering 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$ From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 02 08:32:37 2012 Received: (at 12115) by debbugs.gnu.org; 2 Aug 2012 12:32:37 +0000 Received: from localhost ([127.0.0.1]:56386 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SwuZw-0001LP-Gn for submit@debbugs.gnu.org; Thu, 02 Aug 2012 08:32:36 -0400 Received: from senmx12-mx.siemens-enterprise.com ([62.134.46.10]:50035) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SwuZu-0001LI-J8 for 12115@debbugs.gnu.org; Thu, 02 Aug 2012 08:32:35 -0400 Received: from MCHP02HTC.global-ad.net (unknown [172.29.42.235]) by senmx12-mx.siemens-enterprise.com (Server) with ESMTP id 3419823F06B3; Thu, 2 Aug 2012 14:25:03 +0200 (CEST) Received: from MCHP02MSX.global-ad.net ([169.254.4.77]) by MCHP02HTC.global-ad.net ([172.29.42.235]) with mapi id 14.02.0309.002; Thu, 2 Aug 2012 14:25:02 +0200 From: "Voelker, Bernhard" To: Jim Meyering , Andreas Schwab Subject: RE: bug#12115: Please add tip about using tac to reverse a file byte-by-byte Thread-Topic: bug#12115: Please add tip about using tac to reverse a file byte-by-byte Thread-Index: AQHNcKeQVzgxmKypWEehj3OsD1Xm9ZdGccQw Date: Thu, 2 Aug 2012 12:25:02 +0000 Message-ID: References: <87d339ycz4.fsf@rho.meyering.net> <87txwlwuqv.fsf@rho.meyering.net> <87k3xhwl84.fsf@rho.meyering.net> In-Reply-To: <87k3xhwl84.fsf@rho.meyering.net> Accept-Language: de-DE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.29.42.225] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 12115 Cc: "12115@debbugs.gnu.org" <12115@debbugs.gnu.org>, Reuben Thomas X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Jim Meyering wrote (Thursday, August 02, 2012 2:08 PM): > You need the double quotes around $nl with bash, > but not with zsh: >=20 > zsh$ nl=3D' > quote> ' > zsh$ printf %s $nl >=20 > zsh$ For bash, one solution is: $ printf '\na\nb'|tac -rs '.\|'$(printf "\n") =09 b a $ ;-) Have a nice day, Berny From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 02 09:26:28 2012 Received: (at 12115) by debbugs.gnu.org; 2 Aug 2012 13:26:28 +0000 Received: from localhost ([127.0.0.1]:56446 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SwvQ4-0002Yo-2x for submit@debbugs.gnu.org; Thu, 02 Aug 2012 09:26:28 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:36742) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SwvQ1-0002Yd-4q for 12115@debbugs.gnu.org; Thu, 02 Aug 2012 09:26:26 -0400 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3WnsR151Llz4KK47; Thu, 2 Aug 2012 15:18:53 +0200 (CEST) X-Auth-Info: VZvgMJx7Un1CXYlIVGU5E/IkVCFri6zIHNt60FRF6SE= Received: from igel.home (ppp-88-217-102-86.dynamic.mnet-online.de [88.217.102.86]) by mail.mnet-online.de (Postfix) with ESMTPA id 3WnsR14TJkzbbks; Thu, 2 Aug 2012 15:18:53 +0200 (CEST) Received: by igel.home (Postfix, from userid 501) id 2F2F0CA2A2; Thu, 2 Aug 2012 15:18:53 +0200 (CEST) From: Andreas Schwab To: "Voelker\, Bernhard" Subject: Re: bug#12115: Please add tip about using tac to reverse a file byte-by-byte References: <87d339ycz4.fsf@rho.meyering.net> <87txwlwuqv.fsf@rho.meyering.net> <87k3xhwl84.fsf@rho.meyering.net> X-Yow: I like the IMPUDENT NOSE on that car.. Are you a TEEN-AGER? Date: Thu, 02 Aug 2012 15:18:53 +0200 In-Reply-To: (Bernhard Voelker's message of "Thu, 2 Aug 2012 12:25:02 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 12115 Cc: "12115@debbugs.gnu.org" <12115@debbugs.gnu.org>, Jim Meyering , Reuben Thomas X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) "Voelker, Bernhard" writes: > Jim Meyering wrote (Thursday, August 02, 2012 2:08 PM): > >> You need the double quotes around $nl with bash, Or any other POSIX shell. > For bash, one solution is: > > $ printf '\na\nb'|tac -rs '.\|'$(printf "\n") No, command substitution strips trailing newlines. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 02 09:35:46 2012 Received: (at 12115) by debbugs.gnu.org; 2 Aug 2012 13:35:46 +0000 Received: from localhost ([127.0.0.1]:56464 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SwvZ4-0002m8-MZ for submit@debbugs.gnu.org; Thu, 02 Aug 2012 09:35:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54443) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SwvZ1-0002m0-FQ for 12115@debbugs.gnu.org; Thu, 02 Aug 2012 09:35:44 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q72DSB4G007995 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 2 Aug 2012 09:28:11 -0400 Received: from [10.3.113.77] (ovpn-113-77.phx2.redhat.com [10.3.113.77]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q72DSB3e029635; Thu, 2 Aug 2012 09:28:11 -0400 Message-ID: <501A806A.2030007@redhat.com> Date: Thu, 02 Aug 2012 07:28:10 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0 MIME-Version: 1.0 To: Andreas Schwab Subject: Re: bug#12115: Please add tip about using tac to reverse a file byte-by-byte References: <87d339ycz4.fsf@rho.meyering.net> <87txwlwuqv.fsf@rho.meyering.net> <87k3xhwl84.fsf@rho.meyering.net> In-Reply-To: X-Enigmail-Version: 1.4.3 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig0458CE4907908ED0751BC596" X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: 12115 Cc: "12115@debbugs.gnu.org" <12115@debbugs.gnu.org>, Jim Meyering , "Voelker, Bernhard" , Reuben Thomas X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig0458CE4907908ED0751BC596 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 08/02/2012 07:18 AM, Andreas Schwab wrote: >> For bash, one solution is: >> >> $ printf '\na\nb'|tac -rs '.\|'$(printf "\n") >=20 > No, command substitution strips trailing newlines. So don't make it trailing: printf '\na\nb'|tac -rs "$(printf '\n\\|.')" --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enig0458CE4907908ED0751BC596 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJQGoBrAAoJEKeha0olJ0NqWKEH/17jvm6ahsxoccr4ezceU96j PqNT18h7RDmi+yXqtULEfHXneg3sZV+YR9QlSxJTNSog7OwgIHaL4lKd8J70Fv3c 4ZHO2OgQLAoUc8MjEGoytl3zTxPBTKeHyE3chvl0ASMXbzwSRmVIX7EXDaM2+U0n N/GDGZS/cmQKdn5qkhlpJj+4FVitnVkOW6zYHiZGaD64/0kH/rsiceziy6wS4mna US0xYYshfGirAQiYeWd+ygp7C7sZ566IKslbXPAqeDFsKBOkRFhXC8xW9pSW566m ARoIRtnV/6yHDsks0nZKLJJ9dgWClmMs7Cux7BZdUnSSqWEIHtseupnCNpouUrg= =YkCm -----END PGP SIGNATURE----- --------------enig0458CE4907908ED0751BC596-- From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 02 10:08:52 2012 Received: (at 12115) by debbugs.gnu.org; 2 Aug 2012 14:08:52 +0000 Received: from localhost ([127.0.0.1]:57088 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sww55-0003dx-SP for submit@debbugs.gnu.org; Thu, 02 Aug 2012 10:08:52 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:50436) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sww52-0003dl-Nj for 12115@debbugs.gnu.org; Thu, 02 Aug 2012 10:08:50 -0400 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3WntMb6Khrz4KK6B; Thu, 2 Aug 2012 16:00:43 +0200 (CEST) X-Auth-Info: YIhL3yT/8Fc41ZXFe+j/rDPG7iT6vCm9MPUNCbG5lrs= Received: from igel.home (ppp-88-217-102-86.dynamic.mnet-online.de [88.217.102.86]) by mail.mnet-online.de (Postfix) with ESMTPA id 3WntMH65dlzbbjk; Thu, 2 Aug 2012 16:00:43 +0200 (CEST) Received: by igel.home (Postfix, from userid 501) id 8352ECA2A2; Thu, 2 Aug 2012 16:00:43 +0200 (CEST) From: Andreas Schwab To: Eric Blake Subject: Re: bug#12115: Please add tip about using tac to reverse a file byte-by-byte References: <87d339ycz4.fsf@rho.meyering.net> <87txwlwuqv.fsf@rho.meyering.net> <87k3xhwl84.fsf@rho.meyering.net> <501A806A.2030007@redhat.com> X-Yow: YOW!! Now I'm playing with my HOLOGRAPHIC ATOMIC SIMULATION LASER pinball machine!! WORLD PEACE is in the BALANCE!! Date: Thu, 02 Aug 2012 16:00:43 +0200 In-Reply-To: <501A806A.2030007@redhat.com> (Eric Blake's message of "Thu, 02 Aug 2012 07:28:10 -0600") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 12115 Cc: "12115@debbugs.gnu.org" <12115@debbugs.gnu.org>, Jim Meyering , "Voelker, Bernhard" , Reuben Thomas X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Eric Blake writes: > On 08/02/2012 07:18 AM, Andreas Schwab wrote: >>> For bash, one solution is: >>> >>> $ printf '\na\nb'|tac -rs '.\|'$(printf "\n") >> >> No, command substitution strips trailing newlines. > > So don't make it trailing: > > printf '\na\nb'|tac -rs "$(printf '\n\\|.')" It's still a useless command substitution. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 02 10:11:08 2012 Received: (at 12115) by debbugs.gnu.org; 2 Aug 2012 14:11:08 +0000 Received: from localhost ([127.0.0.1]:57105 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sww7H-0003hm-Qc for submit@debbugs.gnu.org; Thu, 02 Aug 2012 10:11:07 -0400 Received: from exprod7og106.obsmtp.com ([64.18.2.165]:43803) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1Sww7F-0003hd-8z for 12115@debbugs.gnu.org; Thu, 02 Aug 2012 10:11:06 -0400 Received: from mail-yw0-f43.google.com ([209.85.213.43]) (using TLSv1) by exprod7ob106.postini.com ([64.18.6.12]) with SMTP ID DSNKUBqItbf6/wHCTUETqrrCw+19oSvbjToh@postini.com; Thu, 02 Aug 2012 07:03:34 PDT Received: by mail-yw0-f43.google.com with SMTP id 10so11023748yhl.30 for <12115@debbugs.gnu.org>; Thu, 02 Aug 2012 07:03:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=ueJQUwHkDrqh7sAYTQZk9KqxQsubK2OoDmzu8aL5mdY=; b=Wu9tbA0hUDnw/2z+m3EV0oIzDMZROlOBzpxHCTUJU3v32HEV984Ohc/X6UMBuiztVS d7yNdlhWaIFLTTv4v53l5BVTbW3k8AwqeMmnPugd7wQe36pjYRLtIGF0S4tT50Y2Ri2t VIRLldCYqKAOEs2X3AJva+LnzEILBTi8SADVOkUb7ttm4FluhnRk/rOU7mEOThr+OHoo Tfftspj31mY5LrnYhASfrrFOr1tYhNuwrS6egH2MtnRk8l1XRVI+tgtle2Y5KoICCQbZ CtqM8KyHfQkri1YD1R42Khv+hvzYfIbvrykY1dI4p+iFpJLLBuAJ1008RmbCWbFW7Qdv hD+Q== MIME-Version: 1.0 Received: by 10.50.159.135 with SMTP id xc7mr4044792igb.9.1343916213070; Thu, 02 Aug 2012 07:03:33 -0700 (PDT) Received: by 10.231.126.66 with HTTP; Thu, 2 Aug 2012 07:03:33 -0700 (PDT) In-Reply-To: References: <87d339ycz4.fsf@rho.meyering.net> <87txwlwuqv.fsf@rho.meyering.net> <87k3xhwl84.fsf@rho.meyering.net> <501A806A.2030007@redhat.com> Date: Thu, 2 Aug 2012 15:03:33 +0100 Message-ID: Subject: Re: bug#12115: Please add tip about using tac to reverse a file byte-by-byte From: Reuben Thomas To: Andreas Schwab Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQlooslY/8emBoxRz+LpmOaLqra1h9lLTrz7xd2U2/W/k2xKP3SkYmQWbmLqO+X+XmygFmAI X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 12115 Cc: Eric Blake , Jim Meyering , "Voelker, Bernhard" , "12115@debbugs.gnu.org" <12115@debbugs.gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) On 2 August 2012 15:00, Andreas Schwab wrote: > Eric Blake writes: > >> On 08/02/2012 07:18 AM, Andreas Schwab wrote: [blah blah blah] All this just because there's no standard interface in coreutils (or indeed other GNU programs) to control the regexp engine, so you can make "." match any character. LOL. -- http://rrt.sc3d.org From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 01 14:15:35 2013 Received: (at 12115) by debbugs.gnu.org; 1 Feb 2013 19:15:35 +0000 Received: from localhost ([127.0.0.1]:59594 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U1M5H-0001mP-7o for submit@debbugs.gnu.org; Fri, 01 Feb 2013 14:15:35 -0500 Received: from exprod7og113.obsmtp.com ([64.18.2.179]:36527) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1U1M5E-0001mF-A7 for 12115@debbugs.gnu.org; Fri, 01 Feb 2013 14:15:33 -0500 Received: from mail-fa0-f70.google.com ([209.85.161.70]) (using TLSv1) by exprod7ob113.postini.com ([64.18.6.12]) with SMTP ID DSNKUQwUHHz30EocaJsGjLpH/QLnyiPo47CV@postini.com; Fri, 01 Feb 2013 11:14:42 PST Received: by mail-fa0-f70.google.com with SMTP id t1so290784fae.1 for <12115@debbugs.gnu.org>; Fri, 01 Feb 2013 11:14:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-received:in-reply-to:references:date :message-id:subject:from:to:cc:content-type:x-gm-message-state; bh=6IYDhWD8s0OlP6alJAlB75JWk1xcXYUiAGcAa1/4B/4=; b=MQYQo7qTCF6BTBGtg5iCNXQMbsa0JdrZp7Cf2GYUb4HIfKnf1bLTnj5zyhDSPTnDD2 VN6lsWyqrUJ9oA+tC/L401WQM4hE0CtOWDTKS2nauVFMn9YmQ/EWDAR5k6TbrRTTTria ji/p0I66MQvCZ0OqsajYNhCKa9NaTMym9bhmXsHjZaBR4qBrCLUGNmqB8vIsQzKmHEhN R+zH3RFFMEXbK+r4OhtBggLORF5IESWLZbj6fGhvXA+Ja3GI6qteUGlbBkC5CVN6uqk/ lKgFfXuE1H37DDJvkoAbvDC2D2Q7iZzEE6S4zTxqnzhZiNL9N4D50Q4Bhh9sP9dXFJLe ZQbw== X-Received: by 10.152.111.72 with SMTP id ig8mr12102246lab.1.1359746075434; Fri, 01 Feb 2013 11:14:35 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.152.111.72 with SMTP id ig8mr12102242lab.1.1359746075310; Fri, 01 Feb 2013 11:14:35 -0800 (PST) Received: by 10.152.135.36 with HTTP; Fri, 1 Feb 2013 11:14:35 -0800 (PST) In-Reply-To: References: <87d339ycz4.fsf@rho.meyering.net> <87txwlwuqv.fsf@rho.meyering.net> <87k3xhwl84.fsf@rho.meyering.net> <501A806A.2030007@redhat.com> Date: Fri, 1 Feb 2013 19:14:35 +0000 Message-ID: Subject: Re: bug#12115: Please add tip about using tac to reverse a file byte-by-byte From: Reuben Thomas To: Andreas Schwab Content-Type: multipart/alternative; boundary=f46d04083a05cdbb3d04d4ae8d26 X-Gm-Message-State: ALoCoQmZgMgJgFBJCp1gbMECSCuZmUWOeKDBC70PCxtqZTyxN7/Er8MCpEuK0IwUsI/4/XLMXLC148KPfKEKisp+dM6JQn4cqMX6NifeAYJNqCoBE3riXi8Oju8wdLwA1twDaf+TK12EDp8KUNX8cRKkRNTwl4H0eUPQN5Pt88DseCaDwMMkWZc= X-Spam-Score: -1.5 (-) X-Debbugs-Envelope-To: 12115 Cc: Eric Blake , Jim Meyering , "Voelker, Bernhard" , "12115@debbugs.gnu.org" <12115@debbugs.gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) --f46d04083a05cdbb3d04d4ae8d26 Content-Type: text/plain; charset=ISO-8859-1 On 2 August 2012 15:03, Reuben Thomas wrote: > On 2 August 2012 15:00, Andreas Schwab wrote: > > Eric Blake writes: > > > >> On 08/02/2012 07:18 AM, Andreas Schwab wrote: > > [blah blah blah] > > All this just because there's no standard interface in coreutils (or > indeed other GNU programs) to control the regexp engine, so you can > make "." match any character. LOL. > > -- > http://rrt.sc3d.org > 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. So can we have an agreed version substituted into my patch and committed, please? -- http://rrt.sc3d.org --f46d04083a05cdbb3d04d4ae8d26 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On 2 August 2012 15:03, Reuben Thomas &l= t;rrt@sc3d.org> 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. So can we have an agree= d version substituted into my patch and committed, please?
--f46d04083a05cdbb3d04d4ae8d26-- From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 01 16:36:54 2013 Received: (at 12115-done) by debbugs.gnu.org; 1 Feb 2013 21:36:55 +0000 Received: from localhost ([127.0.0.1]:59922 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U1OI2-0005CY-Kn for submit@debbugs.gnu.org; Fri, 01 Feb 2013 16:36:54 -0500 Received: from smtp.cs.ucla.edu ([131.179.128.62]:39794) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U1OHz-0005CM-H1 for 12115-done@debbugs.gnu.org; Fri, 01 Feb 2013 16:36:52 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 7804B39E8105; Fri, 1 Feb 2013 13:36:01 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bqri+UKdZ7a3; Fri, 1 Feb 2013 13:36:00 -0800 (PST) Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id BAE1939E8100; Fri, 1 Feb 2013 13:36:00 -0800 (PST) Message-ID: <510C3540.2010806@cs.ucla.edu> Date: Fri, 01 Feb 2013 13:36:00 -0800 From: Paul Eggert User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Reuben Thomas Subject: Re: bug#12115: Please add tip about using tac to reverse a file byte-by-byte References: <87d339ycz4.fsf@rho.meyering.net> <87txwlwuqv.fsf@rho.meyering.net> <87k3xhwl84.fsf@rho.meyering.net> <501A806A.2030007@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 12115-done Cc: 12115-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.5 (----) 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. I installed this: >From dad0a3c743464664ed6a7ae8445cb58b8326db6d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 1 Feb 2013 13:32:48 -0800 Subject: [PATCH] doc: say how to tac char-by-char This fixes Bug#12115, reported by Reuben Thomas. * doc/coreutils.texi (tac invocation): Document how to reverse a file character by character. Break out MS-DOS into a separate section, like 'cat' does. --- doc/coreutils.texi | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/doc/coreutils.texi b/doc/coreutils.texi index eac8d52..e29af8b 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -1613,10 +1613,7 @@ precedes in the file. @itemx --regex @opindex -r @opindex --regex -Treat the separator string as a regular expression. Users of @command{tac} -on MS-DOS/MS-Windows should note that, since @command{tac} reads files in -binary mode, each line of a text file might end with a CR/LF pair -instead of the Unix-style LF. +Treat the separator string as a regular expression. @item -s @var{separator} @itemx --separator=@var{separator} @@ -1626,8 +1623,18 @@ Use @var{separator} as the record separator, instead of newline. @end table +On systems like MS-DOS that distinguish between text and binary files, +@command{tac} reads and writes in binary mode. + @exitstatus +Example: + +@example +# Reverse a file character by character. +tac -r -s 'x\|[^x]' +@end example + @node nl invocation @section @command{nl}: Number lines and write files -- 1.7.11.7 From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 01 16:44:13 2013 Received: (at 12115-done) by debbugs.gnu.org; 1 Feb 2013 21:44:14 +0000 Received: from localhost ([127.0.0.1]:59938 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U1OP7-0005UZ-Ff for submit@debbugs.gnu.org; Fri, 01 Feb 2013 16:44:13 -0500 Received: from exprod7og121.obsmtp.com ([64.18.2.20]:56506) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1U1OP5-0005UK-3S for 12115-done@debbugs.gnu.org; Fri, 01 Feb 2013 16:44:12 -0500 Received: from mail-wg0-f69.google.com ([74.125.82.69]) (using TLSv1) by exprod7ob121.postini.com ([64.18.6.12]) with SMTP ID DSNKUQw2+OLsuLTamZGP5916403gk0/4vVJ7@postini.com; Fri, 01 Feb 2013 13:43:21 PST Received: by mail-wg0-f69.google.com with SMTP id fn15so5014221wgb.8 for <12115-done@debbugs.gnu.org>; Fri, 01 Feb 2013 13:43:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-received:in-reply-to:references:date :message-id:subject:from:to:cc:content-type:x-gm-message-state; bh=GDVAry+ol+D+UBBIwGTJWSdKnbvHc3unZ4gQ+NxONNs=; b=LErDBmzzQLCI/zoaZc5WOTEB+3h37ILTLzCFK5CXHX65V8s1w6NLqEJmBmdRJErrHm Z3gAmt6TXoUN7rSL2iJvJ/ovImrHTlu0ktMk9lbHD9GAZjfZsAstfvet86rgm6hkFP4i OD7aeFHNX+1ola2rkaDYEe35q2nZ5y5/uNKuJri4Bi8qG5DfxvTRkpLQ18VaMdE2Phab QenqjNGNXOhr4vlpsUWhEXSufClrs8oMMlKrpYRcfbjCzQiPl8X/vBCq4gG4/0GY0MOS QanCV368m7r14a+Jny2CaC7VASdTjyUvmDlhsZtcq2XknQQsYwvrzPlH+4e5HlmLlh08 7uyA== X-Received: by 10.112.38.67 with SMTP id e3mr5168921lbk.105.1359754999759; Fri, 01 Feb 2013 13:43:19 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.112.38.67 with SMTP id e3mr5168917lbk.105.1359754999579; Fri, 01 Feb 2013 13:43:19 -0800 (PST) Received: by 10.152.135.36 with HTTP; Fri, 1 Feb 2013 13:43:19 -0800 (PST) In-Reply-To: <510C3540.2010806@cs.ucla.edu> References: <87d339ycz4.fsf@rho.meyering.net> <87txwlwuqv.fsf@rho.meyering.net> <87k3xhwl84.fsf@rho.meyering.net> <501A806A.2030007@redhat.com> <510C3540.2010806@cs.ucla.edu> Date: Fri, 1 Feb 2013 21:43:19 +0000 Message-ID: Subject: Re: bug#12115: Please add tip about using tac to reverse a file byte-by-byte From: Reuben Thomas To: Paul Eggert Content-Type: multipart/alternative; boundary=e0cb4efe2c24bb436104d4b0a1e6 X-Gm-Message-State: ALoCoQlMus8RO7bw0F6WZxxJb6WvxKBJijpQpqAG9ZTZbnwvj7+/E0ml3SeGRizIKF3+uRwGTr6q+Q/XxXIeEoXofsXFPx+f9eWJdpor75Y3IDI6V2htBWfWnkUdXMktv0Uht6Anda536TgxfN1feHefecIt2hc8DKumpmGV3/bUDcZ5+zdigcc= X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 12115-done Cc: 12115-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) --e0cb4efe2c24bb436104d4b0a1e6 Content-Type: text/plain; charset=ISO-8859-1 On 1 February 2013 21:36, Paul Eggert 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. > 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. --e0cb4efe2c24bb436104d4b0a1e6 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On 1 February 2013 21:36, Paul Eggert &l= t;eggert@cs.ucla.ed= u> 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<= br> 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.

Thanks!

What about a way to do it on a GNU system? It seems reasonable to document GNU-specific hacks in GNU=20 documentation when a portable solution is not forthcoming.
--e0cb4efe2c24bb436104d4b0a1e6-- From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 01 16:47:32 2013 Received: (at 12115-done) by debbugs.gnu.org; 1 Feb 2013 21:47:32 +0000 Received: from localhost ([127.0.0.1]:59942 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U1OSK-0005bv-7F for submit@debbugs.gnu.org; Fri, 01 Feb 2013 16:47:32 -0500 Received: from smtp.cs.ucla.edu ([131.179.128.62]:40402) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U1OSH-0005bm-OX for 12115-done@debbugs.gnu.org; Fri, 01 Feb 2013 16:47:31 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 7822839E8100; Fri, 1 Feb 2013 13:46:39 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Rbiv-uYQas8u; Fri, 1 Feb 2013 13:46:39 -0800 (PST) Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 2D07739E8008; Fri, 1 Feb 2013 13:46:39 -0800 (PST) Message-ID: <510C37BE.2040306@cs.ucla.edu> Date: Fri, 01 Feb 2013 13:46:38 -0800 From: Paul Eggert User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Reuben Thomas Subject: Re: bug#12115: Please add tip about using tac to reverse a file byte-by-byte References: <87d339ycz4.fsf@rho.meyering.net> <87txwlwuqv.fsf@rho.meyering.net> <87k3xhwl84.fsf@rho.meyering.net> <501A806A.2030007@redhat.com> <510C3540.2010806@cs.ucla.edu> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -1.8 (-) X-Debbugs-Envelope-To: 12115-done Cc: 12115-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On 02/01/13 13:43, Reuben Thomas wrote: > What about a way to do it on a GNU system? I think it works if you set LC_ALL='C', as the C locale is unibyte on a GNU system, but someone should double-check this. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 01 16:52:58 2013 Received: (at 12115-done) by debbugs.gnu.org; 1 Feb 2013 21:52:58 +0000 Received: from localhost ([127.0.0.1]:59947 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U1OXZ-0005ms-QS for submit@debbugs.gnu.org; Fri, 01 Feb 2013 16:52:58 -0500 Received: from exprod7og118.obsmtp.com ([64.18.2.8]:32928) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1U1OXX-0005mi-M3 for 12115-done@debbugs.gnu.org; Fri, 01 Feb 2013 16:52:56 -0500 Received: from mail-ea0-f199.google.com ([209.85.215.199]) (using TLSv1) by exprod7ob118.postini.com ([64.18.6.12]) with SMTP ID DSNKUQw5BMFEbOovNNCmI6W1iNu3kzWby5+C@postini.com; Fri, 01 Feb 2013 13:52:05 PST Received: by mail-ea0-f199.google.com with SMTP id j10so5031643eaa.10 for <12115-done@debbugs.gnu.org>; Fri, 01 Feb 2013 13:52:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-received:in-reply-to:references:date :message-id:subject:from:to:cc:content-type:x-gm-message-state; bh=hJygKboFcTEQg+mJYS5hqeZnBbE98EDEB1gV/t5uSoM=; b=LyK8jBB7FmDgEP2ozXDW7oDijdFLWBdvBo4eg2ZXyBJDtROKGj+L93mm/+x5SJP0OA Vg2AyIbgsDJsx43gCiJWKXevOvDHX3ysuCJhxOumpNNOQ/5gFYTHQYHZhChq0RrjDx8U ce/II7vDgERMxE86s0jvkn0oFs6uVI7eA8f9ecB7Ny6EEQg0c8EIdd5JzXTuLJd2itGX unCDxn1drKxUSPmXHzvSLybDPDVlXzr2BFWqOQZrLSXWf209IW5iYRNmxQVZFGsZJI10 +jIOE2qw3DXCWgTdm4LWsU1OHyu5/njHwZpKI/8nUlZujVM/MxL/Alk9ZKtlkaJv+XoG 75Wg== X-Received: by 10.152.113.6 with SMTP id iu6mr12541975lab.43.1359755524519; Fri, 01 Feb 2013 13:52:04 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.152.113.6 with SMTP id iu6mr12541963lab.43.1359755524291; Fri, 01 Feb 2013 13:52:04 -0800 (PST) Received: by 10.152.135.36 with HTTP; Fri, 1 Feb 2013 13:52:04 -0800 (PST) In-Reply-To: <510C37BE.2040306@cs.ucla.edu> References: <87d339ycz4.fsf@rho.meyering.net> <87txwlwuqv.fsf@rho.meyering.net> <87k3xhwl84.fsf@rho.meyering.net> <501A806A.2030007@redhat.com> <510C3540.2010806@cs.ucla.edu> <510C37BE.2040306@cs.ucla.edu> Date: Fri, 1 Feb 2013 21:52:04 +0000 Message-ID: Subject: Re: bug#12115: Please add tip about using tac to reverse a file byte-by-byte From: Reuben Thomas To: Paul Eggert Content-Type: multipart/alternative; boundary=f46d0408915101bb0004d4b0c1ef X-Gm-Message-State: ALoCoQk6pV86FRljfYgNvcijQTD6+t0ySaxBew9b5ssw3xCxnv78/6sgDot/ZrqywcTM9oSQBdxXpWL9GndgKBa9riVuLn+89vaDVoCcgi8jc8wlcabMWkMf8iOj//0YgihKaiCBTDKxXFzqwpoWIe+zsLO4eOQ2gY8oF/qDQWciIaXPw+LQJuo= X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 12115-done Cc: 12115-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) --f46d0408915101bb0004d4b0c1ef Content-Type: text/plain; charset=ISO-8859-1 On 1 February 2013 21:46, Paul Eggert wrote: > On 02/01/13 13:43, Reuben Thomas wrote: > > What about a way to do it on a GNU system? > > I think it works if you set LC_ALL='C', as the > C locale is unibyte on a GNU system, but someone > should double-check this. > A bit of searching does not reveal to me how to verify or disprove this, but how about using a known unibyte-locale such as an ISO8859 one? Or is the problem then that there's none that can be guaranteed to exist? -- http://rrt.sc3d.org --f46d0408915101bb0004d4b0c1ef Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On 1 February 2013 21:46, Paul Eggert &l= t;eggert@cs.ucla.ed= u> wrote:
On 02/01/13 13:43, Reuben Thomas wrote:
> What about a way to do it on a GNU system?

I think it works if you set LC_ALL=3D'C', as the
C locale is unibyte on a GNU system, but someone
should double-check this.

A bit of searching = does not reveal to me how to verify or disprove this, but how about using a= known unibyte-locale such as an ISO8859 one? Or is the problem then that t= here's none that can be guaranteed to exist?
--f46d0408915101bb0004d4b0c1ef-- From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 01 17:05:26 2013 Received: (at 12115-done) by debbugs.gnu.org; 1 Feb 2013 22:05:26 +0000 Received: from localhost ([127.0.0.1]:59953 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U1Oje-0006AS-3C for submit@debbugs.gnu.org; Fri, 01 Feb 2013 17:05:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:9138) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U1Oja-0006AE-1s for 12115-done@debbugs.gnu.org; Fri, 01 Feb 2013 17:05:24 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r11M4O6S028738 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 1 Feb 2013 17:04:24 -0500 Received: from [10.3.113.16] ([10.3.113.16]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r11M4NcG019835; Fri, 1 Feb 2013 17:04:23 -0500 Message-ID: <510C3BE6.10800@redhat.com> Date: Fri, 01 Feb 2013 15:04:22 -0700 From: Eric Blake Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Reuben Thomas Subject: Re: bug#12115: Please add tip about using tac to reverse a file byte-by-byte References: <87d339ycz4.fsf@rho.meyering.net> <87txwlwuqv.fsf@rho.meyering.net> <87k3xhwl84.fsf@rho.meyering.net> <501A806A.2030007@redhat.com> <510C3540.2010806@cs.ucla.edu> In-Reply-To: X-Enigmail-Version: 1.5.0 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2VIOTGVSNSSWPPDNRWXCH" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Spam-Score: -7.2 (-------) X-Debbugs-Envelope-To: 12115-done Cc: 12115-done@debbugs.gnu.org, Paul Eggert X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -7.2 (-------) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2VIOTGVSNSSWPPDNRWXCH Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 02/01/2013 02:43 PM, Reuben Thomas wrote: > On 1 February 2013 21:36, Paul Eggert wrote: >=20 >> 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=3DC to force single-byte characters. >> >=20 > Thanks! >=20 > What about a way to do it on a GNU system? It seems reasonable to docum= ent > 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=3DC for reversing by bytes instead of characte= rs? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2VIOTGVSNSSWPPDNRWXCH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRDDvnAAoJEKeha0olJ0NqJCQH/0N2vFIpZnUDIoCGBR9I4I8N INlmy9MCqCgkYuVBGC6dzDFzeHHEO1fxzikyUHdrRnU0dkL3bgwxB4gS48jBGAv/ s8EUD0A+SmOxuFG220zcRlpETe46d0QYK9y3b8dHvlBvciZ4BdZV0Y3AjNtj8NNB TIW8TuTWF7WhK8LKQHkgmgcdbl+VP8TZyI0BS6QfrwpPBZehbPcYzoJyMydvzS2j RL126roNme7kYM9UTdFZT1XGKIkd9faLIgRR8YBXaDF12P6vYZ9YYIMl/G8Z8ENe w9gpXeEcuiT4058nP/uZVFF4BnfedkSy8WM4o/OkeVZUZePeCNvyRy4njU7qawU= =6Aa7 -----END PGP SIGNATURE----- ------enig2VIOTGVSNSSWPPDNRWXCH-- From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 01 17:24:20 2013 Received: (at 12115-done) by debbugs.gnu.org; 1 Feb 2013 22:24:20 +0000 Received: from localhost ([127.0.0.1]:59992 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U1P1v-0006ok-D5 for submit@debbugs.gnu.org; Fri, 01 Feb 2013 17:24:20 -0500 Received: from smtp.cs.ucla.edu ([131.179.128.62]:42143) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U1P1t-0006ob-6l for 12115-done@debbugs.gnu.org; Fri, 01 Feb 2013 17:24:17 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id D121239E8105; Fri, 1 Feb 2013 14:23:26 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZADmlOcYJ29G; Fri, 1 Feb 2013 14:23:26 -0800 (PST) Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 84C2739E8008; Fri, 1 Feb 2013 14:23:26 -0800 (PST) Message-ID: <510C405D.7060708@cs.ucla.edu> Date: Fri, 01 Feb 2013 14:23:25 -0800 From: Paul Eggert User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Reuben Thomas Subject: Re: bug#12115: Please add tip about using tac to reverse a file byte-by-byte References: <87d339ycz4.fsf@rho.meyering.net> <87txwlwuqv.fsf@rho.meyering.net> <87k3xhwl84.fsf@rho.meyering.net> <501A806A.2030007@redhat.com> <510C3540.2010806@cs.ucla.edu> <510C37BE.2040306@cs.ucla.edu> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -1.8 (-) X-Debbugs-Envelope-To: 12115-done Cc: 12115-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On 02/01/13 13:52, Reuben Thomas wrote: > how about using a known unibyte-locale such as an ISO8859 one? Or is > the problem then that there's none that can be guaranteed to exist? Yes, that's the problem. POSIX does not require the existence of any unibyte locale. Even the C locale might be multibyte, and is multibyte, at least on OS X systems. From unknown Sun Jun 22 03:54:11 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 02 Mar 2013 12:24:02 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator