Last active
July 15, 2022 06:37
-
-
Save akoserwal/a8ead4cfbc4b978533839bbc56ed6f29 to your computer and use it in GitHub Desktop.
parsing-key-value-with-jq
This file contains 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
dataseturl=https://gist.githubusercontent.com/akoserwal/4817cccbb53262056405bcc1eef37443/raw/7af7a0a6a60b5e2b8699f0c6e779c236e8f1055d/sample-output.json | |
map=$(curl $dataseturl | jq -r '.[]') | |
echo $map | |
echo $map | jq -r '[.id, .name, .value] | @csv'| tr -d '"' | \ | |
while IFS=, read -r id name value ; do | |
echo $id:$value | |
if [[ $name =~ test* ]] ; | |
then | |
echo "$id,$name,$value" >> generated.csv | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment