diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/osm/osm.osc.create | 13 |
1 files changed, 9 insertions, 4 deletions
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 | |||
4 | do | 4 | do |
5 | TYPE=$(echo $line | cut -d ' ' -f1) | 5 | TYPE=$(echo $line | cut -d ' ' -f1) |
6 | ID=$(echo $line | cut -d ' ' -f2) | 6 | ID=$(echo $line | cut -d ' ' -f2) |
7 | |||
8 | # create new tags from input line, for example: | ||
9 | # key1_added "value1" key2_added "value2" key3_removed key4_removed | ||
10 | |||
11 | # key should not quoted, value must be quoted | ||
12 | # And keys which need to be removed must be placed at the end | ||
7 | NEW_TAGS=$(echo $line |\ | 13 | NEW_TAGS=$(echo $line |\ |
8 | cut -d' ' -f3- | xargs -n2 echo |\ | 14 | cut -d' ' -f3- |\ |
9 | sed -r 's/^([^ ]+) (.+)/<tag k=\"\1\" v=\"\2\"\/>/' |\ | 15 | sed -r 's/([^ "]+) (\"[^"]+\")/<tag k=\"\1\" v=\2\/>/g; s/>[^"]*$/>/') |
10 | paste -s) | ||
11 | 16 | ||
12 | TAG_PATTERN=$(echo $line |\ | 17 | TAG_PATTERN=$(echo $line |\ |
13 | cut -d' ' -f3- | xargs -n2 echo |\ | 18 | cut -d' ' -f3- | xargs -n2 echo |\ |
14 | cut -d' ' -f1 | paste -s -d'|') | 19 | cut -d' ' -f1 | paste -s -d'|') |
15 | 20 | ||
16 | echo $TAG_PATTERN > /dev/tty | 21 | echo $NEW_TAGS > /dev/tty |
17 | 22 | ||
18 | cat $1 |\ | 23 | cat $1 |\ |
19 | sed -nr "/<$TYPE id=\"$ID\"/,/<\/$TYPE/ { | 24 | sed -nr "/<$TYPE id=\"$ID\"/,/<\/$TYPE/ { |