From 7bc4647d2cafd56eccb2e26e59469c1e4d53950e Mon Sep 17 00:00:00 2001 From: typebrook Date: Sun, 17 Nov 2019 23:00:03 +0800 Subject: update --- scripts/osm/osm.osc.create | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'scripts/osm/osm.osc.create') diff --git a/scripts/osm/osm.osc.create b/scripts/osm/osm.osc.create index c9bdaa8..ed34c90 100755 --- a/scripts/osm/osm.osc.create +++ b/scripts/osm/osm.osc.create @@ -4,16 +4,21 @@ while read -r line do TYPE=$(echo $line | cut -d ' ' -f1) ID=$(echo $line | cut -d ' ' -f2) + + # create new tags from input line, for example: + # 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 NEW_TAGS=$(echo $line |\ - cut -d' ' -f3- | xargs -n2 echo |\ - sed -r 's/^([^ ]+) (.+)//' |\ - paste -s) + cut -d' ' -f3- |\ + sed -r 's/([^ "]+) (\"[^"]+\")//g; s/>[^"]*$/>/') TAG_PATTERN=$(echo $line |\ cut -d' ' -f3- | xargs -n2 echo |\ cut -d' ' -f1 | paste -s -d'|') - echo $TAG_PATTERN > /dev/tty + echo $NEW_TAGS > /dev/tty cat $1 |\ sed -nr "/<$TYPE id=\"$ID\"/,/<\/$TYPE/ { -- cgit v1.2.3-70-g09d2