coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[coreutils] Re: coreutils | join.c | handling of spaces in output


From: Pádraig Brady
Subject: [coreutils] Re: coreutils | join.c | handling of spaces in output
Date: Wed, 08 Sep 2010 13:04:44 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3

On 08/09/10 11:35, Bernhard Schiffner wrote:
> Hi,
> 
> working with differnet versions of join I noticed something I consider a bug:
> 
> Multiple spaces from input  are reduced to only one in the output:
> 
> Try to join
> 25259f7a611bb258ddb2ee73dd83d22c
> with
> 25259f7a611bb258ddb2ee73dd83d22c  /O L D  ST U F F/Logo2.png
> 
> (Notice the _two_ spaces here: "..22c  /O..." and "..D  ST..")
> 
> The output is single spaced "D ST" 
> - in version 6.10 (as in Debian Lenny)
> - in recent git
> with two spaces "D  ST"
> - in version 7.1 (as in OpenSuse 11.2)
> 
> For the separator it seems ok, but for "data" it is IMHO not so good.)
> 
> Do you have any idea, how to solve / circumvent this?
> (Perhaps some magic with join -t ?)
> 
> TIA!
> 
> Bernhard
> 
> PS:
> (Opensuse 11.2):
> bernd@bs7:~> join bbb malvers-groups-hash-dupes
> 25259f7a611bb258ddb2ee73dd83d22c  /O L D  ST U F F/Logo2.png
> 
> (recent git):
> bernd@bs7:~> ./Dokumente/developing/coreutils/src/join bbb malvers-groups-
> hash-dupes
> 25259f7a611bb258ddb2ee73dd83d22c /O L D ST U F F/Logo2.png

It is interesting that suse is different
I tested solaris, FreeBSD, Fedora and git and they
all output a single space only, as follows:

$ join <(printf "c\n") <(printf "c  /1 s 2  s\n") | tr ' ' .
c./1.s.2.s

I.E. they split to fields first and output each field
individually, even if only the first field is used in the match.
One can get the behavior you want by specifying an explicit space:

$ join -t " " <(printf "c\n") <(printf "c  /1 s 2  s\n") | tr ' ' .
c../1.s.2..s

It's a bit surprising, but consistent I think, given
one can match on any particular field.

cheers,
Pádraig.



reply via email to

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