how to join two files using "Join" command with one common field in this problem?
file1:
file2:
here,I want output like this way-->> Toronto:Ontario:6:ON
so,I tried using "join" command this way -->> join -t: -j1 5 -j2 2 -o 1.1 2.1 2.2 2.3 file1 file2
which gives me this output,
"join: file 1 is not in sorted order
join: file 2 is not in sorted order
Edmonton:Alberta:9:AB"
So,i dont understand here why it's giving me only one output line and error that files are not sorted.Do i need to sort the files before joining them?
please help me,I'm a newbie here!
Thanks.
Last edited by radoulov; 04-13-2012 at 06:54 AM..
Reason: Code tags!
Hello,
This post is already here but want to do this with another way
Merge multiples files with multiples duplicates keys by filling "NULL" the void columns for anothers joinning files
file1.csv:
1|abc
1|def
2|ghi
2|jkl
3|mno
3|pqr
file2.csv:
1|123|jojo
1|NULL|bibi... (2 Replies)
Hi,
I have 20 tab delimited text files that have a common column (column 1). The files are named GSM1.txt through GSM20.txt. Each file has 3 columns (2 other columns in addition to the first common column).
I want to write a script to join the files by the first common column so that in the... (5 Replies)
Hi experts,
Would you please help me with this?
I have several files and I need to join the forth field of them based on the common first field.
here's an example...
first file:
280346 39.88 -75.08 547.8
280690 39.23 -74.83 538.7
280729 40.83 -75.08 499.2
280907 40.9 -74.4 507.8... (5 Replies)
Hello;
I am posting to get any help on my code that I have been struggling for some time. The project is to join two files each with 80k~180k rows. I want to merge them together by the shared common column. The problem of the shared column is partially matching, not exactly the same.
File1:... (5 Replies)
I have a vim outliner file like this:
Title
title 2
:Testing now
:testing 2
:testing 3
title 3
:testing
:ttt
:ttg
Is there a way to use a script or command to remove... (7 Replies)
Hi All,
I have working (Perl) code to combine 2 input files into a single output file using the join function that works to a point, but has the following limitations:
1. I am restrained to 2 input files only.
2. Only the "matched" fields are written out to the "matched" output file and... (1 Reply)
I have 2 files with a common parm - Jobname
File 1
0507 1202 JOBA
0507 1302 JOBB
0507 1452 JOBC
0507 1552 JOBA
0507 1553 JOBA
File2
JOBA abcdefg server4
JOBB defghij server22
JOBC vwxyz12 server55
I would like to take each line from File1 and match the jobname with the jobname... (8 Replies)
I want to join two lines together when the second line contains "US DOLLAR".
How to do that with sed?
Original file:
# cat testdata
Sep. 24, 2005 Sep. 26, 2005 PHARMA PLUS DRUGMART 1149 $5.85
Sep. 25, 2005 Sep. 27, 2005 99 RESTAURANT #015
$11.00 US DOLLAR @ 1.203636 $13.24 ... (2 Replies)