I got a lot of files looking like this:
All together there are ard 1'000'000 lines in each of the ard 100 files.
I want to build the average for every line, and write the result to a new file.
The averaging should start at a specific line, here for example at line 380'000.
Help is much appreciated...
chillmaster
PS: This should be done for data files of CFD calculations, exactly to average a transient calculation and read it with postprocessor again.
So the first (here ard 380'000) lines are the coordinates of the field points following hereafter...
Do you mean average accross hundreds of files - ie., line 474000 average from files 1...200? This would mean each file has the same number of lines, which based on your explanation does not seem to be the case.
yep, you are rite.
Maybe i wrote a little confused, English isnt my mother tongue...
Anyway, rite now I got 100 files each with 1'050'000 rows, just one column.
Every file is a specific point of time.
I want an average for each line over all the 100 files (Line 1 for all 100 files, Line 2 ...).
However, I need to start averaging at a specific line, something ard 380'000.
These first 380'000 rows are coordinate points.
I think first I need to join the files, that I get one file with 1'050'000 rows and 100 columns. I tried:
just for two files, but it isnt working.
It seems that there is a limit for the lenght of the files...
Great. I got it. Try something like this.
Assume your files have the same base name with numbers after them 1 - 100 or so and the files are called filename1... filename<nnn>
The %.3f format specifier controls the precision of the output, this rounds to 1000ths
thank you very much for your help.
The first part is working, the second part brings a syntax error at awk line 3.
Unfortunately, I dont know anything about awk.
I will check the syntax in the next few days, since it seems to me very powerful.
I would be very happy, if you could help me again anyway, because I think I need some time to get the awk usage...
One more question about sorting the files:
The first part makes a really big file, while I cant see at which position one file ends and the next is starting. Actually, you set an awk comand with the number 670'000, I think thats the file lenght of each seperate file in the big outpufile, is that rite?
Anyway, do you know, how i can join multiple one column files to one multiple column file. Seems to me not to be a really difficult task, however, I cant find any helpful information.
I need your help to discover missing elements for each box.
In theory each box should have 4 items: ITEM01, ITEM02, ITEM08, and ITEM10.
Some boxes either have a missing item (BOX02 ITEM08) or might have da duplicate item (BOX03 ITEM02) and missing another one (BOX03 ITEM01).
file01.txt
... (2 Replies)
I have the following format of input from multiple files
File 1
24.01 -81.01 1.0
24.02 -81.02 5.0
24.03 -81.03 0.0
File 2
24.01 -81.01 2.0
24.02 -81.02 -5.0
24.03 -81.03 10.0
I need to scan through the files and when the first 2 columns match I... (18 Replies)
Hi,
I want to rename several files like this:
example:
A0805120817.BHN
A0805120818.BHN
.....
to:
20120817.0805.N
20120818.0805.N
......
How can i do this via terminal or in shell bash script ?
thanks, (6 Replies)
Hi all,
I have a list of numbers. I need an awk command to find out the numbers of elements (number of numbers, sort to speak), the average value the min and max value. Reading the list only once, with awk.
Any ideas?
Thanks! (5 Replies)
I have several sequential files with name stat.1000, stat.1001....to stat.1020 with a format like this
0.01 1 3822 4.97379915032e-14 4.96982253992e-09 0
0.01 3822 1 4.97379915032e-14 4.96982253992e-09 0
0.01 2 502 0.00993165137406 993.165137406 0
0.01 502 2 0.00993165137406 993.165137406 0... (6 Replies)
Hello there,
I found an elegant solution to computing average values from multiple text files
awk '{for (i=1;i<=NF;i++){if ($i!~"n/a"){a+=$i}else{b++}}}END{for (i=1;i<=FNR;i++){for (j=1;j<=NF;j++){printf (a/(3-b))((b>0)?"~"b" ":" ")};printf "\n"}}' file1 file2 file3
I tried to modify... (2 Replies)
This code works perfect when using a machine with only one interface online. (Excluding the loopback of course) But when I have other interface up for vmware or a vpn the output gets mixed up. I know I had this working when I was just reading ip's from files so I know it is not a problem with... (8 Replies)
Hi,
first, I have searched in the forum for this, but I could not find the right answer. (There were some similar threads, but I was not sure how to adapt the ideas.)
Anyway, I have a quite natural problem: Given are several text files. All files contain the same number of lines and the same... (3 Replies)
I have a file that looks like this
452 025_E3
8 025_E3
82 025_F5
135 025_F5
5 025_F5
23 025_G2
38 025_G2
71 025_G2
9 026_A12
81 026_A12
10 026_A12
some of the elements in column2 are repeated.
I want an output file that will extract the... (1 Reply)
Hi,
I have 20 files which have respective 50 lines with different values.
I would like to process each line of the 50 lines in these 20 files one at a time and do an average of 3rd field ($3) of these 20 files. This will be output to an output file.
Instead of using join to generate whole... (8 Replies)