Skip to content

Instantly share code, notes, and snippets.

@timhodson
Created December 17, 2018 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timhodson/6fcf432a559141fc1266247692ef9e0e to your computer and use it in GitHub Desktop.
Save timhodson/6fcf432a559141fc1266247692ef9e0e to your computer and use it in GitHub Desktop.
Make a linking table for list URI to Hierarchy URI.
# Utility called csvfix https://bitbucket.org/neilb/csvfix
# first pick the two columns we are interested in - list link, and hierarchy link.
# then split the hierarchy link (which is now colomn 2) on the semi-colon SPACE that is used to delimit.
# then unflatten - i.e. make a record(row) with the first column as key and each of the split columns as value.
# e.g.
# <key>,<val1>,<val2>,<val3>
# becomes
# <key>,<val1>
# <key>,<val2>
# <key>,<val3>
# and put it into a file as your linking table.
csvfix order -f 2, 8 all_lists_2017_09_21.csv\
| csvfix split_char -f 2 -c '; '\
| csvfix unflatten -k 1\
> list-to-node-code-mapping.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment