join file1 file2 
Author Message
 join file1 file2


>anybody could I tell me how to use join for joinning two files.

type 'man awk' or 'info awk' at the command line

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.*-*-*.com/ - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----

Tue, 19 Nov 2002 03:00:00 GMT  
 join file1 file2

join is a {*filter*} command (IMHO) and to use it correctly you will
need to have your input files sorted first (man sort).
The command,

  join file1 file2

takes the first column of file1, and for each string that it
matches in the first column of file2 prints out that string
followed by the remainder of the the line in file1 and then
the remainder of that line in file2. As I said, {*filter*}.
For example, if file1 is:

a 1
a 4
a 7
a 8
z 3
z 5

and file2 is:

a 1
a 2
a 8
b 5
b 6
z 9

then the output of join file1 file2 would look like:

a 1 1
a 1 2
a 1 8
a 4 1
a 4 2
a 4 8
a 7 1
a 7 2
a 7 8
a 8 1
a 8 2
a 8 8
z 3 9
z 5 9

However, I have a feeling that this probably wasn't what you
were after. If you want to have two files "joined" end to end
then use:

  cat file1 file2

or side by side, use:

  paste file1 file2

man cat, man paste.

Incidentally, with question like this, you'll probably get a
better response on



> Hi,
> anybody could I tell me how to use join for joinning two files.

> thaks.

Tue, 19 Nov 2002 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. file1 / file2 ??

2. if file1.txt < file2.txt echo smaller

3. newbie: grep -1f file1 file2 in Python

4. Oops: difference in operation of string.join and ''.join

5. join array

6. Join The APL95 Team

7. Why people should join STIC

8. join

9. Alan Key joins HP?

10. Joining Broken Lines

11. How to join five rows in one row?

12. Joining lines


Powered by phpBB® Forum Software