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:
00.00, 00.10, 00.20,....23.50
File structure is:
x | y | temperature
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:
x | y | temperature-filename 00.00 | temerature-filename 00.10 | ... | temperature-filename 23.50
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.
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:
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?
HOORAY! we' re getting closer
This code seems to get a bit closer...
Look, I really appreciate your efforts on my problem! To make it easier, for me it would be just fine if I had an output like this:
This is the column i need one by the other under the file name. This code can then easily be pasted in a libreoffice calc document with the given X and Y's and that way I will be able to print graphs. I will be completely fine with this.
Thanks again. Have a nice day!