My requirement is combine yday and today csv file and create final output file. taking consideration of common columns 1,2,3,5,6 in both yday and today file .
sometimes today file counts are greater than the file counts of yday one.
So merging would only take 1st row of (combined column of 1,2,3,5,6 ) lowest count file (yady) to the first row (combined column of 1,2,3,5,6 ) of highest count file (today) and the very same records (combined column of 1,2,3,5,6 ) for next one in the highest count file (today) should have NA NA NA as there is no record matching for lowest count since 1st row of (combined column of 1,2,3,5,6 ) lowset count file matched above.
please refer below input file for different cases
PS: All field separator is , instead of "TAB". My mistake.
case one
today.csv
Code:
36000807 A 123 78 0 1 0.1 0.2 0.3
36000807 A 123 79 0 1 -0.1 0.2 -0.3
36000807 A 123 78 0 5 0.1 0.2 0.3
36000807 A 123 79 0 5 -0.1 0.2 -0.3
36000807 A 123 78 0 10 0.1 0.2 0.3
36000807 A 123 79 0 10 -0.1 0.2 -0.3
yday.csv
Code:
36000807 A 123 76 0 1 0.56 0.47 0.39
36000807 A 123 76 0 5 -0.34 0.27 -0.38
36000807 A 123 76 0 10 -0.14 0.25 -0.53
merged file
Code:
f1.1 f1.2 f1.3 f1.4 f1.5 f1.6 f1.7 f1.8 f1.9 f2.4 f2.7 f2.8 f2.9
36000807 A 123 78 0 1 0.1 0.2 0.3 76 0.56 0.47 0.39
36000807 A 123 79 0 1 -0.1 0.2 -0.3 76 NA NA NA
36000807 A 123 78 0 5 0.1 0.2 0.3 76 -0.34 0.27 -0.38
36000807 A 123 79 0 5 -0.1 0.2 -0.3 76 NA NA NA
36000807 A 123 78 0 10 0.1 0.2 0.3 76 -0.14 0.25 -0.53
36000807 A 123 79 0 10 -0.1 0.2 -0.3 76 NA NA NA
--------------------------today.csv------------------------------------------****-----------yday.csv------------
option two
Code:
today.csv
36000807 A 123 78 0 1 0.1 0.2 0.3
36000807 A 123 79 0 1 -0.1 0.2 -0.3
36000807 A 123 78 0 5 0.1 0.2 0.3
36000807 A 123 79 0 5 -0.1 0.2 -0.3
36000807 A 123 78 0 10 0.1 0.2 0.3
36000807 A 123 79 0 10 -0.1 0.2 -0.3
yday.csv
Code:
36000807 A 123 76 0 5 -0.34 0.27 -0.38
36000807 A 123 76 0 10 -0.14 0.25 -0.53
final merged file
Code:
f1.1 f1.2 f1.3 f1.4 f1.5 f1.6 f1.7 f1.8 f1.9 f2.4 f2.7 f2.8 f2.9
36000807 A 123 78 0 1 0.1 0.2 0.3 NA NA NA NA
36000807 A 123 79 0 1 -0.1 0.2 -0.3 NA NA NA NA
36000807 A 123 78 0 5 0.1 0.2 0.3 76 -0.34 0.27 -0.38
36000807 A 123 79 0 5 -0.1 0.2 -0.3 76 NA NA NA
36000807 A 123 78 0 10 0.1 0.2 0.3 76 -0.14 0.25 -0.53
36000807 A 123 79 0 10 -0.1 0.2 -0.3 76 NA NA NA
--------------------------today.csv-----------------------------------------***-----------yday.csv------------
case three
today.csv
Code:
36000807 A 123 78 0 1 0.1 0.2 0.3
36000807 A 123 78 0 5 0.1 0.2 0.3
36000807 A 123 79 0 10 -0.1 0.2 -0.3
yday.csv
Code:
36000807 A 123 76 0 1 0.56 0.47 0.39
36000807 A 123 76 0 5 -0.34 0.27 -0.38
36000807 A 123 76 0 10 -0.14 0.25 -0.53
Hey,
I have a problem with nslookup under the newly installed mandrake 9.1, and as I see now also under Redhat 8.0
I have a pc called evo with the ip 10.0.0.1 which entered correctly in the /etc/hosts file. Connection to the internet is via an adsl-router. I have the nameservers from my... (2 Replies)
Hi All,
I am writing some data's into a file from C++ program. The files which i am writing is of fixed length . say 232 in length per line.
I am writing as . my c code is as
... (0 Replies)
Hi
All,
How can you sort a file that is doubled space ( where even number lines are blank lines) and still preserves the blank lines?
You can use grep,sed and regular expression.
Thanks
Vishal (4 Replies)
I have 2 files
file1.txt
a 123 aqsw
c 234 sfdr
fil2.txt
b 345 hgy
d 4653 jgut
I want to merger in such a manner the the output file should be
outfile.txt
a 123 aqsw
b 345 hgy
c 234 sfdr
d 4653 jgut
Do we have any command to achive this? (8 Replies)
Hi All:
I have following files:
File 1:
<header>
text...
text ..
text ..
text ..
<\header>
x
y
z
...
File 2:
<header>
text...
text ..
text .. (4 Replies)
Hi everyone, need your help in sorting and merging two numerical lists
Example:
I have one list 1 2 3 4 5 7 and the other 4 6 8, then the final output should be 1 2 3 4 5 6 7 8
Requesting your kind help in this
Regards,
RB :) (1 Reply)
Hi
I’m new to scripting and have only had about two days experience with this. I have questions about a bash/gawk script.
Problem:
I have 27 files, which needs to get merged into one, the files are separated into 8 subdivisions containing a 3 row data description. Example of data
File.1
... (7 Replies)
Hello,
I have a master database of a dictionary with the following structure:
a=b (b is a Unicode string)
a is the English part and b is the equivalent in a foreign language
I have also another file which has a database where the /b/ part of the string has been corrected by an expert. let us... (5 Replies)
Dear All, I have two file like this:
file1:
a1234
b1235
c4678
d7859
file2 :
e4575
f7869
g7689
h9687
I want output like this:
a1234
b1235
c4678 (2 Replies)