[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unexpand -t4 converts too much whitespace to tabs
From: |
Jim Meyering |
Subject: |
Re: unexpand -t4 converts too much whitespace to tabs |
Date: |
Sat, 19 Jul 2003 19:33:43 +0200 |
Thanks for reporting that.
"Charles Karney" <address@hidden> wrote:
> Problem
> The documentation for unexpand claims
> * that only initial whitespace is converted (unless -a is given)
> * that only sequences of 2 or more spaces are converted
>
> Neither of these is true for nondefault tab settings.
...
> Repeat with...
>
> Interior white space is converted in this example
> $ echo 'a b' | unexpand -t4 | tr '\t' X
> aXb
That is according to the documentation -- at least the documentation
in the latest releases.
Here's part of the --help output from unexpand in coreutils-5.0.1,
this means it's in the automatically-generated man page, too:
-t, --tabs=N have tabs N characters apart instead of 8 (enables -a)
-t, --tabs=LIST use comma separated LIST of tab positions (enables -a)
It's also mentioned in `info unexpand':
`-t TAB1[,TAB2]...'
`--tabs=TAB1[,TAB2]...'
If only one tab stop is given, set the tabs TAB1 spaces apart
instead of the default 8. Otherwise, set the tabs at columns
TAB1, TAB2, ... (numbered from 0), and leave spaces and tabs
beyond the tabstops given unchanged. Tabstops can be separated by
blanks as well as by commas. This option implies the `-a' option.
> A single space is converted in this example
> $ echo 'aaa b' | unexpand -t4 -a | tr '\t' X
> aaaX b
This looks like a real bug.
So I've just added this to the TODO file:
unexpand: [http://www.opengroup.org/onlinepubs/007908799/xcu/unexpand.html]
printf 'x\t \t y\n'|unexpand -t 8,9 should print its input, unmodified.
printf 'x\t \t y\n'|unexpand -t 5,8 should print "x\ty\n"
The latest test release is available here:
ftp://alpha.gnu.org/gnu/coreutils/coreutils-5.0.1.tar.bz2
(coreutils is the union of fileutils, textutils, and sh-utils)