I'm currently working on a little project; in a kml file called weatherdata.kml, I would like to extract the sea level pressure for each <Placemark>
element. I'm trying to parse the information about the sea level pressure and put it into a file called report.csv
; and print the sea level pressure on a new line each time.
I think this would work with awk
and so far I've tried this:
awk -F '[>,]' '/minSeaLevelPres/ {print $2}' report.csv
But when I run this command in shell, I get this:
1002</minSeaLevelPres
1002</minSeaLevelPres
1002</minSeaLevelPres
1001</minSeaLevelPres
1001</minSeaLevelPres
1001</minSeaLevelPres
1001</minSeaLevelPres
1001</minSeaLevelPres
1001</minSeaLevelPres
1001</minSeaLevelPres
1001</minSeaLevelPres
1002</minSeaLevelPres
1002</minSeaLevelPres
1003</minSeaLevelPres
when I want to get this:
1002
1002
1002
1001
1001
1001
1001
1001
1001
1001
1001
1002
1002
1003
I can't work out how to get rid of </minSeaLevelPres
. Would anyone be able to help?
Below is an example of part of a placemark element in weatherdata.kml
<Placemark>
<styleUrl>#ex</styleUrl>
<lat>19.2</lat>
<lon>-24.1</lon>
<stormName>NINE</stormName>
<stormNum>10</stormNum>
<basin>AL</basin>
<stormType>LO</stormType>
<intensity>20</intensity>
<intensityMPH>23</intensityMPH>
<intensityKPH>37</intensityKPH>
<minSeaLevelPres>1002</minSeaLevelPres>
<atcfdtg>2020082350</atcfdtg>
<dtg>0000 UTC JAN 07</dtg>
</Placemark>