11-05-2009
join command
Hi
my problem is:
I've 2 files like:
file1:
Quote:
1 3.791406e-03 65388.3
6 8.568031e-01 1.47768e+07
17 1.323488e-01 2.28255e+06
47 5.928275e-03 102242
50 1.037607e-03 17895
89 9.085876e-05 1566.99
file2
Quote:
1 3.839507e-03 66217.9
6 8.563433e-01 1.47689e+07
10 0.000000e+00 0
17 0.000000e+00 0
..so many zeros
47 5.863369e-03 101122
50 1.020259e-03 17595.9
..so many zeros
89 0.0000000e+00 0
..so many zeros
I'd like to get file_out:
Quote:
|
1 3.791406e-03 65388.3 3.839507e-03 66217.9 |
6 8.568031e-01 1.47768e+07 8.563433e-01 1.47689e+07 |
17 1.323488e-01 2.28255e+06 0.000000e+00 0 |
47 5.928275e-03 102242 5.863369e-03 101122 |
50 1.037607e-03 17895 1.020259e-03 17595.9 |
89 9.085876e-05 1566.99 0.0000000e+00 0 |
I mean if the field is different from zero in the first file i want take that field also in the second(no matter if in the second is zero).
I tried with the join command but it doesn't work always and i don't understand why.
Can anyone help please?
thanks in advance
D
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I'm using the join command and it appears to discard certain fields. Here are the two files i'm comparing:
File1:
1 a
2 b
3 c
4 d
99 f
101 g
999 i
200 j
File 2:
1 e
2 f
3 g
4 h
99 h (22 Replies)
Discussion started by: penfold
22 Replies
2. Shell Programming and Scripting
Hi,
I am trying to use join command for two files of size greater than 1 GB.
join -t , -1 2 -2 1 -o 1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,1.10,1.11,1.12,1.13,1.14,1.15,1.16,1.17,1.18,1.19,1.20,1.21,1.22,1.23 File1 File2 > File3
we are facing space crunch after using these join command.
May i... (0 Replies)
Discussion started by: jerome Sukumar
0 Replies
3. Shell Programming and Scripting
Hi,
I am a new learner of join command. Some result really make me confused.
Please kindly help me.
input:
file1:
LEO oracle engineer 210375
P.Jones Office Runner ID897
L.Clip Personl Chief ID982
S.Round UNIX admin ID6
file2:
Dept2C ID897 6 years
Dept5Z ID982 1 year
Dept3S ID6 2... (1 Reply)
Discussion started by: summer_cherry
1 Replies
4. Shell Programming and Scripting
Dear Experts,
I have several (say 'm') text files, each with 'n' columns. I want to put them into a large single file with n*m columns.
a 1 a 1 a 1 a 1
b 2 b 5 b 1 b 3
c 3 c 7 ... (1 Reply)
Discussion started by: Mish_99
1 Replies
5. Shell Programming and Scripting
All,
I have 3 files (tab seperated):
Note: Please treat dash (-) as empty value in the file, I have added it to make input easily readable
file1: (2 cols)
A 1
B 2
C 3
file2: (4 cols - col4 has empty values for 4th column except 2nd row)
A 1 5 -
B 2 6 Y
C 3 7 -
D 4 8 -
file3... (1 Reply)
Discussion started by: bgmmk
1 Replies
6. Shell Programming and Scripting
Hello,
I am using join to merge two files together. The defaults usually works great
join file1 file2 However, sometimes file1 or file2 has more keys, which I want to keep.
file 1:
-1 z
0 a
1 b
2 c
file 2:
0 a2
1 b2
2 c2
3 c3
So I do
join -a1 -a2 file1 file2 But then you don't... (0 Replies)
Discussion started by: ayu
0 Replies
7. Shell Programming and Scripting
input1
a_a a/a 10 100
a1 a_a 20 200
b1 b_b 30 300
input2
a_a a/a xxx yyy
a1 a1 lll ppp
b1 b_b kkk ooo
output
a_a a/a 10 100 xxx yyy (2 Replies)
Discussion started by: ruby_sgp
2 Replies
8. UNIX for Dummies Questions & Answers
file1:
Toronto:12439755:1076359:July 1, 1867:6
Quebec City:7560592:1542056:July 1, 1867:5
Halifax:938134:55284:July 1, 1867:4
Fredericton:751400:72908:July 1, 1867:3
Winnipeg:1170300:647797:July 15, 1870:7
Victoria:4168123:944735:July 20, 1871:10
Charlottetown:137900:5660:July 1, 1873:2... (2 Replies)
Discussion started by: mindfreak
2 Replies
9. UNIX for Dummies Questions & Answers
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)
Discussion started by: evelibertine
5 Replies
10. UNIX for Dummies Questions & Answers
Hi,
Please explain the working process of join command.
File 1
P B
S A
C AFile2
C B
P A
S DBut the output of join command is...
join File1.txt File2.txt
P B A
S A DBut I guess the output should be
P B A
S A D
C A BPlease correct me,if i am worong or missing some thing.
Thanks (2 Replies)
Discussion started by: satyar
2 Replies
LEARN ABOUT SUSE
page_util_quote
page_util_quote(n) Parser generator tools page_util_quote(n)
__________________________________________________________________________________________________________________________________________________
NAME
page_util_quote - page character quoting utilities
SYNOPSIS
package require page::util::quote ?0.1?
package require snit
::page::util::quote::unquote char
::page::util::quote::quote'tcl char
::page::util::quote::quote'tclstr char
::page::util::quote::quote'tclcom char
_________________________________________________________________
DESCRIPTION
This package provides a few utility commands to convert characters into various forms.
API
::page::util::quote::unquote char
A character, as stored in an abstract syntax tree by a PEG processor (See the packages grammar::peg::interpreter, grammar::me, and
their relations), i.e. in some quoted form, is converted into the equivalent Tcl character. The character is returned as the result
of the command.
::page::util::quote::quote'tcl char
This command takes a Tcl character (internal representation) and converts it into a string which is accepted by the Tcl parser, will
regenerate the character in question and is 7bit ASCII. The string is returned as the result of this command.
::page::util::quote::quote'tclstr char
This command takes a Tcl character (internal representation) and converts it into a string which is accepted by the Tcl parser and
will generate a human readable representation of the character in question. The string is returned as the result of this command.
The string does not use any unprintable characters. It may use backslash-quoting. High UTF characters are quoted to avoid problems
with the still prevalent ascii terminals. It is assumed that the string will be used in a double-quoted environment.
::page::util::quote::quote'tclcom char
This command takes a Tcl character (internal representation) and converts it into a string which is accepted by the Tcl parser when
used within a Tcl comment. The string is returned as the result of this command.
BUGS, IDEAS, FEEDBACK
This document, will undoubtedly contain bugs and other problems. Please report such in the category page of the Tcllib SF Trackers
[http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have.
KEYWORDS
page, parser generator, quoting, text processing
COPYRIGHT
Copyright (c) 2007 Andreas Kupries <andreas_kupries@users.sourceforge.net>
page 1.0 page_util_quote(n)