From b2470324e3927c5e505ff206aa6d6fe63f42a191 Mon Sep 17 00:00:00 2001 From: typebrook Date: Tue, 19 Nov 2019 21:34:34 +0800 Subject: update --- scripts/osm/osm.osc.create | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100755 scripts/osm/osm.osc.create (limited to 'scripts/osm/osm.osc.create') diff --git a/scripts/osm/osm.osc.create b/scripts/osm/osm.osc.create deleted file mode 100755 index cc92c1d..0000000 --- a/scripts/osm/osm.osc.create +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -# create new tags from input line, for example: -# field1 field2 field3 field4 field5 field6 field7 field8... -# [element type] [element ID] key1_added "value1" key2_added "value2" key3_removed key4_removed... - -# key should not quoted, value must be quoted -# And keys which need to be removed must be placed at the end -while read -r line -do - TYPE=$(echo $line | cut -d ' ' -f1) # field1 is type - ID=$(echo $line | cut -d ' ' -f2) # field2 is ID - - # transform key-value pair into tag format: - # - # keys without values are omitted - NEW_TAGS=$(echo $line |\ - cut -d' ' -f3- |\ - sed -r 's/([^ "]+) (\"[^"]+\")//g; s/>[^"]*$/>/') - - # get regex pattern need to removed from original osm element: - # key1|key2|key3|key4 - TAG_PATTERN=$(echo $line |\ - cut -d' ' -f3- | xargs -n2 echo |\ - cut -d' ' -f1 | paste -s -d'|') - - echo $NEW_TAGS > /dev/tty - - # print matched element with new tags to .osc file - cat $1 |\ - sed -nr "/<$TYPE id=\"$ID\"/,/<\/$TYPE/ { - /<$TYPE id=\"$ID\"/ { - s/(version=\"[0-9]+\")(.*)/\1>/ - a \ \ \ \ $NEW_TAGS - } - /> $1.osc -done - -# Add .osc structure for output -sed -ir '1 i - 1 i - $ a - $ a ' $1.osc -- cgit v1.2.3-70-g09d2