diff options
-rwxr-xr-x | scripts/periupport_conv | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/scripts/periupport_conv b/scripts/periupport_conv index 2a74007..aa1956d 100755 --- a/scripts/periupport_conv +++ b/scripts/periupport_conv @@ -9,6 +9,11 @@ DST="$2" uuid_cmd="cat /proc/sys/kernel/random/uuid" gawk -F: -v dst="$DST" -v cmd="$uuid_cmd" ' + function make_filename(nam) { + gsub(/[: /]+/, "_", nam) + sub(/_$/, "", nam) + return nam + } $1 == "B" { bsp_id = $2 desc = substr($0, 46) @@ -32,10 +37,8 @@ gawk -F: -v dst="$DST" -v cmd="$uuid_cmd" ' FS = " " for (task in tasks) { - nam = task - gsub(/[: /]/, "_", nam) cmd | getline uuid; close(cmd); - F=dst "/" nam ".yaml" + F = dst "/" make_filename(task) ".yaml" delete(sorted_idx) asorti(tasks[task], sorted_idx) |