Use Perl to find all files in a directory starting with this word then take out date & two data point for each file
Posted on 2011-03-14
I have a series of files that start with kilauea in a directory. They have emissions values for two vent locations. the files contain 3 lines of text (1 line of headers and two lines of data) that looks like this below.
2011-02-03 04:00:13,summit,2011-01-21 20:05:00,2011-01-31 20:16:00,10,6,686,191
2011-02-03 04:00:13,east_rift,2011-01-22 00:50:49,2011-01-22 00:50:49,0,1,312,0
I have to create a single output file that looks at the SHIPDATE, STATION, & MEAN then creates a single line for each file. In the file above the output line would look like this below. Summit station mean would be column 2 and east_rift (or whatever name in row 3) would be column 3 in the output line. Its important NOT to use the actual names of the station but rather the location of the data line in the file since the names of the vents may change.
2011-02-03 686 312
Then a similar line would be created for each file and put into a single master file called emissionsmaster.txt I would then be able to import the emissionsmaster.txt file for use in graphical programs or excel to generate charts showing fluctuations of emissions rates based on archived data. Thanks.