Skip to content

Instantly share code, notes, and snippets.

@0ncorhynchus
Created August 4, 2016 08:33
Show Gist options
  • Save 0ncorhynchus/cee8a9859d885cbebfc26b61dd15235f to your computer and use it in GitHub Desktop.
Save 0ncorhynchus/cee8a9859d885cbebfc26b61dd15235f to your computer and use it in GitHub Desktop.
#!/bin/bash
IFS=$'\t'
awk -F '\t' '{print $1 "\t" $4}' | while read -r line; do
set -- $line
id=$1
json=$2
metanetx=$(echo $json | jq -rM --unbuffered 'try (."MetaNetX (MNX) Equation" | .[] | .id) catch ""')
kegg=$(echo $json | jq -rM --unbuffered 'try (."KEGG Reaction" | .[] | .id) catch ""')
ec=$(echo $json | jq -rM --unbuffered 'try (."EC Number" | .[] | .id) catch ""')
echo "$id,$metanetx,$kegg,$ec"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment