Created
December 12, 2019 00:08
-
-
Save mtholder/6df8b6142510c81f857af2031dcbd803 to your computer and use it in GitHub Desktop.
takes a path to an Open Tree NexSON. writes a element of python dict mapping the filename to a frozenset of mapped OTT Ids
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| fp=$1 | |
| fn=$(basename $fp) | |
| if ! test -f $fp ; then | |
| echo "$fp does not exist" | |
| exit 1 | |
| fi | |
| o=`grep '"^ot:ottId": ' "$fp" | sed 's/".*": //' | sort -g | sed ':a;N;$!ba;s/\n/ /g' | sed -E 's/ +/ /g'` | |
| echo "\"${fn}\": frozenset([ ${o} ])," |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment