[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
join ?
From: |
Maarten . Vanneste |
Subject: |
join ? |
Date: |
Fri, 17 Oct 2008 12:08:45 +0200 |
Hello,
I have the following question about the join command. I thought join would
merge the columns of different files when the same index or value is
present in the specified columns. Now I have the impression that it does
not work fine when the two data files do not have the same number of
values or range.
For example, I created the following files:
echo 84 150 | gawk '{for (i=$1;i<=$2;i++) printf "%i %s\n", i,"A"}' >
testA
echo 109 150 | gawk '{for (i=$1;i<=$2;i++) printf "%i %s\n", i,"B"}' >
testB
join -1 1 -2 1 testA testB > testAB
This file is empy, though I anticipated the rows from values 109 to 150 to
be joined.
Using 84 (or 109) instead of 109 (or 84) gives the expected output. I
thought the join command would read one file and scan the other to find
the corresponding record, and as such only return those rows occurring in
the two files.
I tried this on both cygwin (6.10) and linux operating system (6.9).
Looking forward to hearing from you,
Maarten
=================
Dr. Maarten Vanneste
International Centre for Geohazards - Norwegian Geotechical Institute
Oslo, Norway
www.geohazards.no
www.ngi.no
_____________________________
Neither the confidentiality nor the integrity of this message can be
guaranteed following transmission on the Internet. The addressee should
consider this risk and take full responsibility for use of this message.
This e-mail has been swept by Norman antivirus software.
- join ?,
Maarten . Vanneste <=