commit 59253fc7597e15b5c2ec1244fbd3bd2dcb49d2b7
parent 40bdbcee3d9e97b1d30bea2673f570d9bc5d3ebc
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Wed, 2 Dec 2020 16:29:24 +0100
add script to convert 1d and 2d arrays from ncdump to tsv
Diffstat:
1 file changed, 20 insertions(+), 0 deletions(-)
diff --git a/.local/bin/ncdump2tsv b/.local/bin/ncdump2tsv
@@ -0,0 +1,20 @@
+#!/usr/bin/awk -f
+
+{
+ if (match($0, /^}$/))
+ isdata = 0
+
+ if (isdata) {
+ gsub(/, /, "\t", $0)
+ gsub(/,$/, "", $0)
+ gsub(/^ */, "", $0)
+ gsub(/ *;/, "", $0)
+ print
+ }
+
+ if (match($0, /^data:$/)) {
+ getline
+ getline
+ isdata = 1
+ }
+}