Hello all,
I am quite new in linux shell scripting and I have this issue.
I ve got some files including measurements taken every 10minutes for a whole day.
File name format is:
File structure is:
x and y is the same in all files (same sampling places). Only temperatures change.
What i want to do is merge all files in one file that will be like:
In other words, for fixed X and Y, to put all the temperatures one after the other incrementally and export everything in one file (not in shell because system may crash due to the number of files and data).
I tried awk, sed and grep scripts. What i find a bit tricky is to pass the file name in the script and create a loop that increases in [0-9][0-9].[0-9] [0-9] mode.
Any help would be highly appreciated. Thank you in advance.
Regards.
A.
Last edited by Scrutinizer; 02-11-2013 at 07:18 AM..
Reason: code tags
Hello and thanks a lot for your immediate reply.
It was my mistake to use "|" as separator because the actual separator is " " (single space) and files are .dat
Guess the code that does the work and has a file as an output is:
Right?
---------- Post updated at 01:49 PM ---------- Previous update was at 01:43 PM ----------
Just tried it. It really works, apart from one thing: This code puts one file at the end of the other.
Example:
file1-00.00
x y temp
1 1 10
and file2-00.10
x y temp
1 1 12
Become file output
x y temp
file1-00.00
1 1 10
file2-00.10
1 1 12
I would prefer the output to be like
x y temp-file1-00.00 temp-file2-00.10 temp-fileXX-23.50
1 1 10 12 zz
Nope... it is breaking somewhere... :-(
I changed the file names in an easier pattern. Now they are all in 00.00.dat (00.00.dat, 00.10.dat, ... , 23.50.dat)
I attach a sample so that you can have a better view.
Thank you once again for your time!
Kind regards
A.
In other words the script is not printing the x/y values and it only prints only the first price of each file (i took a sample of 3 files) in one column not in one row.
The output, according to these sample files should be like:
It works perfectly for extracting the first and second columns ( X=1 or =2) but for X = 3 it puts again the column one at the end of the other, not side by side. What am I missing?
Hi ALL,
I have two file. I need to combine these two file based on a layout.
I used the below code and able to extract the record. But now able to insert that to a 3'rd file in between the extract
FILE 1
CAID NUMBER 1-20
TID NUMBER 21-22
LABEL CHAR 23-44
BASE 45-60... (5 Replies)
Hi All,
I have 4 files in below format. I took them as an example.
File 1: Cut from position 1-4 then 6-7 then 8-14 then rest left and make them as columns in one new file. Inserting character H to the initial of all line like HCTOT.
CTOT 456787897 Low fever
CTOR 556712345 High fever... (2 Replies)
Hi All,
I am trying to merge all the text files into one file using below snippet
cat /home/Temp/Test/Log/*.txt >> all.txt
But it seems it is not working.
I have multiple files like Output_ServerName1.txt, Output_ServreName2.txt
I want to merge each file into one single file and... (6 Replies)
Hi all,
I'm looking for a way to merge multiple columns (from one file) into a single column in an output file.
The file I have looks somewhat like this:
@HWI-ST212 1:N:0 AGTCCTACCGGGAGT + @@@DDDDDHHHHHII
@HWI-ST212 1:N:0 CGTTTAAAAATTTCT + @;@B;DDDDH?:F;F... (4 Replies)
Hi,
Can anyone suggest quick way to get desired output?
Sample input file content:
A 12 9
A -0.3 2.3
B 1.0 -4
C 34 1000
C -111 900
C 99 0.09
Output required:
A 12 9 -0.3 2.3
B 1.0 -4
C 34 1000 -111 900 99 0.09
Thanks (3 Replies)
Hi
I have multiple files each with two columns and I need to combine all those file into a tab delimited file. (multiple entry with same name separated by a comma)
The content of the files are as follows:
---
file1.txt:
name var1
aaa xx
aaa gg
bbb yy
ddd zz
---
file2.txt
... (8 Replies)
I have 100 data files labelled 250.1.txt through 250.100.txt. The second column of the data files partially match (there is about %90 overlap). Each data file has 4 columns.
I want the merge all these text files by the matching values in the second column. In the output, the first column should... (1 Reply)
Hi,
I have file1.txt and file2.txt and would like to create file3.txt based on one column in UNIX
Eg:
file1.txt
17328756,0000786623.pdf,0000786623
20115537,0000793892.pdf,0000793892
file2.txt
12521_74_4.zip,0000786623.pdf
12521_15_5.zip,0000793892.pdf
Desired Output
... (5 Replies)