Skip to content

Instantly share code, notes, and snippets.

@jaw111
Created December 19, 2017 21:45
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 jaw111/88fc9e97ed9bbb8e2551c612c7a69d0b to your computer and use it in GitHub Desktop.
Save jaw111/88fc9e97ed9bbb8e2551c612c7a69d0b to your computer and use it in GitHub Desktop.
cat myFile.nt | \
sed -E 's|<(.*)> <(.*)> <(.*)> \.|{ "@id": "\1", "\2": { "@id": "\3" } }|' | \
sed -E 's|<(.*)> <(.*)> "(.*)" \.|{ "@id": "\1", "\2": "\3" }|' | \
sed -E 's|<(.*)> <(.*)> "(.*)"\^\^<http://www.w3.org/2001/XMLSchema#string> \.|{ "@id": "\1", "\2": "\3" }|' | \
sed -E 's|<(.*)> <(.*)> "(.*)"\^\^<(.*)> \.|{ "@id": "\1", "\2": { "@values": "\3", "@type": "\4" } }|'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment