aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2019-11-14 02:23:39 +0800
committertypebrook <typebrook@gmail.com>2019-11-14 02:23:39 +0800
commit96384f23883b0f5447f7eac355bdfdda1ccc8863 (patch)
treec05df83f19235a7384d9e0be7ea6d23950697e05
parent0d6adfe752875aa1e4a985dbd92509af7f1fbdf8 (diff)
update
-rw-r--r--utils/osm18
1 files changed, 18 insertions, 0 deletions
diff --git a/utils/osm b/utils/osm
index 532d133..43fd9f6 100644
--- a/utils/osm
+++ b/utils/osm
@@ -171,6 +171,24 @@ osm.update() {
171 sed '' 171 sed ''
172 fi 172 fi
173} 173}
174# $1 as osm file, $2 as diff file
175osm.update2() {
176 while read -r line
177 do
178 array=( $(echo $line) )
179
180 cat $1 |\
181 sed -nr "/<$array[1] id=$array[2]/,/<\/$array[1]/ {
182 /<$array[1] id=$array[2]/ a \ \ \ \ <tag k=$array[3] v=$array[4]\/>
183 /<tag k=$array[3]/ !p
184 /<\/$array[1]/ q
185 }" |\
186 awk -F"\"" '
187 BEGIN{OFS="\""}
188 {if(NR==1) print $1,$2,$3,$4+1,">"; else print $0}
189 ' > $1.updated
190 done
191}
174# $1 as .osm file $2 as list of change content 192# $1 as .osm file $2 as list of change content
175# use Diff upload: POST /api/0.6/changeset/#id/upload maybe? 193# use Diff upload: POST /api/0.6/changeset/#id/upload maybe?
176osm.osc.create() { 194osm.osc.create() {