bug-coreutils
[Top][All Lists]
Advanced

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

bug#26029: Problems with join


From: Bernhard Voelker
Subject: bug#26029: Problems with join
Date: Thu, 9 Mar 2017 00:06:43 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0

tag 26029 notabug
close 26029
stop

On 03/08/2017 06:39 PM, Peter Kluge wrote:
>    Hello Mike Haertel,
> 
>    I've a problem with the join-command
>    2 Files , compare-field  in one file first in the other second filed.
>    Files attached
> 
>    I want as output to have the compare-file and then the rest-content of
>    file_1 followed by the rest-content of file-2
>    Doesn't work. See Script. (also attached)
> 
>    My mistake?

As Reuti said, join(1) can not print matching lines first and then non-matching
ones in one go.  But if you wouldn't mind if the ones with missing entries
are interleaved, then you could do it like this:

  $ join -t: -1 1 -2 2 -e '--' -a 1 -a 2 -o 0,2.1,1.1,1.2,1.3,1.4,1.5,1.6  
teilnehmer sortierte-Zeiten
  101:3h32'27:101: Willi Wild: Waltraud Weisnix: Mercedes:A:Profi
  102:2h55'11:102: Hans Hirnlos: Nici Blondie: Hummer: D:Profi
  104:4h05'00:104: Klaus Knall: Siegfried Schmerzfrei: Kia:D:Profi
  105:2h43'19:105: Georg Schnell: Dieter Durchblick: Mitsubishi:TN:Profi
  106:3h02'58:106: Stanislaw Oswandrik: Andrujek Jerin: Bolder:PL:Profi
  109:4h15'39:109: Richard Reich: Evi Schimmerlos: BMW:D:Profi
  113:5h05'41:--:--:--:--:--:--
  201:4h18'31:201: Gunther Genuegsam: Anne Sorglos: Suzuki:A: Amateur
  206:3h45'48:206: Oswald Ossi: Lars Ossi: Lada:CZ:Amateur
  210:--:210: Kurt Schrotti: NN: Range Rover:D:Amateuer
  213:3h49'59:213: Peter Kluge: Benjamin Kluge : Toyota:D:Amateuer
  215:7h20'00:215: Werner Weglos: Paul Planlos: Eigenbau:A:Amateur
  217:3h38'28:217: Otto Ohneplan:i Egon Egal: VW:D:Amateur
  222:5h10'05:222: Pit Profil: Jerry Thunder: Range Rover:GB:Amateur

The arguments "-a 1" and "-a 2" tell join to output also non-matching
lines, and "-e '--'" defines to print the string "--" for the fields
of non-matching columns.  In this case, you also need a more sophisticated
"-o" definition than "auto".

As this is not a bug in the program, but a wrong expectation of how the
tool works, I'm marking this issue as such in the bug tracker.  Of course,
you're still welcome to continue the discussion here.

Have a nice day,
Berny






reply via email to

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