Skip to content

Commit 8567ae9

Browse files
committed
Extractor tool for plan txt file
1 parent fac8d40 commit 8567ae9

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

Pilot1/Uno/get-node-txt.awk

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
# GET NODE TXT AWK
3+
# See get-node-txt.sh
4+
5+
$2 == node && $1 == "node:" {
6+
print $0;
7+
while (1) {
8+
if (getline <= 0) {
9+
# EOF:
10+
exit;
11+
}
12+
13+
if ($1 == "node:") {
14+
# The next node is starting:
15+
exit;
16+
}
17+
# Good node data:
18+
print $0;
19+
}
20+
}

Pilot1/Uno/get-node-txt.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
set -eu
3+
4+
# GET NODE TXT
5+
# Pull out one node from a plan txt file
6+
7+
if (( ${#} != 2 ))
8+
then
9+
echo "get-node-txt: Provide PLAN_JSON NODE"
10+
exit 1
11+
fi
12+
13+
PLAN_JSON=$1
14+
NODE=$2
15+
16+
THIS=$( dirname $0 )
17+
18+
awk -v node=$NODE -f $THIS/get-node-txt.awk < $PLAN_JSON

0 commit comments

Comments
 (0)