我有以下結構的巨大KML文件:拆分一個巨大的KML文件
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Style id="transBluePoly">
<LineStyle>
<width>1.5</width>
</LineStyle>
<PolyStyle>
<color>30ffa911</color>
</PolyStyle>
</Style>
<Style id="labelStyle">
<IconStyle>
<color>ffffa911</color>
<scale>0.35</scale>
</IconStyle>
<LabelStyle>
<color>ffffffff</color>
<scale>0.35</scale>
</LabelStyle>
</Style>
<Placemark>
<name>9840229084|2013-03-06 13:41:34.0|rent|0.0|2|0|0|1|T|5990F529FB98F28A1F17D182152201A4|0|null|null|null|null|null|null|null|null|null|null|F|F|0|NO_POSTCODE</name>
<styleUrl>#transBluePoly</styleUrl>
<Polygon>
<outerBoundaryIs>
<LinearRing>
<coordinates>
-1.5191200,53.4086600
-1.5214300,53.4011900
-1.5303600,53.4028800
-1.5435800,53.4033900
-1.5404900,53.4083600
-1.5191200,53.4086600
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
<Placemark>
<name>9840031669|2013-03-06 13:14:22.0|rent|0.0|0|0|0|1|F|E5BAC836984F53F91D7F60F247920F0C|0|null|null|null|null|null|null|null|null|null|null|F|F|3641161|DE4 3JT</name>
<styleUrl>#transBluePoly</styleUrl>
<Polygon>
<outerBoundaryIs>
<LinearRing>
<coordinates>
-1.2370933,53.1227587
-1.2304837,53.1690463
-1.1783129,53.2226956
-1.2016444,53.2833233
-1.3213687,53.3248921
-1.4809916,53.3039582
-1.6167192,53.2438689
-1.5593782,53.1336370
-1.4296123,53.0962399
-1.3205129,53.1024090
-1.2370933,53.1227587
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
我需要提取開始1萬個多邊形,使之更易於管理(知道地理DB是終極解決方案 - 尋找快速解決)。
將其加載到一個輕量級的文本編輯器中,只需刪除一些行就可以成爲我的第一通話端口,但懷疑這需要花費一整天的時間(這是10 GB,我有16 GB RAM)。只是想知道是否有一個來自linux終端的更智能的解決方案,避免了將其全部讀入RAM中。我已經看到了perl和bash命令,但是看不到它們如何工作以獲得隨機(或第一百萬)樣本:http://www.unix.com/shell-programming-scripting/159470-filter-kml-file-xml-remove-unwanted-entries.html