I have roughly ~30 .txt files in a directory which all have unique names. These files all contain text arranged in columns separated by whitespace (example file:
[#YY MM DD hh mm WDIR WSPD GST WVHT DPD APD MWD PRES ATMP WTMP DEWP VIS TIDE
#yr mo dy hr mn degT m/s m/s m sec sec deg hPa degC degC degC nmi ft
2012 05 31 23 50 60 0.8 0.9 0.04 99.00 2.77 999 1016.7 7.1 5.3 999.0 99.0 99.00
2012 06 01 00 50 30 1.8 2.2 0.04 99.00 2.77 999 1016.8 6.0 5.3 999.0 99.0 99.00
2012 06 01 01 50 42 0.7 1.3 0.13 99.00 3.98 999 1016.4 6.4 4.8 999.0 99.0 99.00
2012 06 01 02 50 105 2.3 2.6 0.04 99.00 3.46 999 1016.5 5.3 4.6 999.0 99.0 99.00
...
...
...
)
I am looking to extract columns from these files (ie: PRES, which runs from the 54-59 char in each line) so that i can find their average value accross each file. I would like these outputs to remain distinct and indentifiable to the original file.
In the end, I am looking to extract data from the files with the following names:
4500172012.txt
4500182012.txt
4500262012.txt
4500272012.txt
4500282012.txt
4500362012.txt
4500372012.txt
4500382012.txt
4500462012.txt
4500472012.txt
4500482012.txt
4500562012.txt
4500572012.txt
4500582012.txt
4500662012.txt
4500672012.txt
4500682012.txt
4500762012.txt
4500772012.txt
4500782012.txt
4500862012.txt
4500872012.txt
4500882012.txt
4501262012.txt
4501272012.txt
4501282012.txt
I am looking to extract the columns PRES, ATMP, and WTMP (char 54-59, 62-65, 68-71 respectively).
How can I do this?
Thank you for any help you can provide.