From f22bbf1ed606adb6140f1c8cc0b723cbb476fa82 Mon Sep 17 00:00:00 2001 From: typebrook Date: Mon, 18 Nov 2019 13:40:36 +0800 Subject: update --- scripts/osm/osm.osc.create | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'scripts/osm/osm.osc.create') diff --git a/scripts/osm/osm.osc.create b/scripts/osm/osm.osc.create index ed34c90..93a6640 100755 --- a/scripts/osm/osm.osc.create +++ b/scripts/osm/osm.osc.create @@ -1,15 +1,15 @@ #!/bin/bash +# create new tags from input line, for example: +# [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) 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- |\ sed -r 's/([^ "]+) (\"[^"]+\")//g; s/>[^"]*$/>/') @@ -22,9 +22,12 @@ do cat $1 |\ sed -nr "/<$TYPE id=\"$ID\"/,/<\/$TYPE/ { - /<$TYPE id=\"$ID\"/ a \ \ \ \ $NEW_TAGS - // + a \ \ \ \ $NEW_TAGS + } + /> $1.osc done -- cgit v1.2.3-70-g09d2