Extract rows from multiple .int files into a single new file

Hi all!
I have several .int files in two folders.
Each .int = 1 station
In these .int there is data of environmental variables like T°C, Sal, Depth, etc.
I would like to be able to merge all those .int into a single csv file by selecting for each a line with respect to a depth criterion.
For example extract in the csv of station 1 the environmental data corresponding to the depth 400m.
And for each station I want to choose myself the depth at which I want the data.

Each csv looks like this :

1
2  Station : 1 
3  Latitude : xxxx
4  Longitude : xxxx
5
6
7   Depth  Temp  Sal   pH .... 
8     0    (numeric data)
9     10   (numeric data)
10    20   (numeric data)
11    30   (numeric data)
12    40   (numeric data)
13    50   (numeric data)

And what I would like, it's to have a final dataframe like this :

Station  Depth Temp  Sal  pH
1         400  (numeric data)
2         390  (numeric data)
3         150  (numeric data)
4         216  (numeric data)
5         180  (numeric data)
6         430  (numeric data)

So, to summarize, I would like to extract the 400m line for station 1, the 390m line for station 2, etc.
What complicates things for me is that the environmental data starts at the 7th line because before it is occupied by the description of the station.

Sorry for this rather complex and possibly poorly worded request.

Thanks a lot !

1 Like