Skip to content
Advertisement

Tag: json

Linux grep command to find the value of key from json

I have a JSON output that contains a list of objects stored in a variable.(I may not be phrasing that right) Output of a curl command: will post in comment as I am unable to post here I want to grep the value at this position “ad6743fae9c54748b8644564c691ba58” shown in the output, which changes everytime i run the curl command. I

Bash Jq parse json string

I’ve to call a file and pass a json as parameters in this way (suppose that my file is called test.sh), from bash I need to do something like this: and the content of test.sh is the following the output of -> printf “$system_user” is but the output of -> printf “$accounts” is something like this [ [ { “username”:

shell script to read values from one file and replace it in other file

I would like to replace a set of strings into a new file. Source file file1.json values has to be replaced by values from file1.config into file file2.json. I have following script that is failing to do so. file1.json file1.config run.sh Error: file2.json appears, but it has no values replaced. Answer Just explaining the comment of @user3159253. Your file1.config should

diagnosing when I’m being limited by disk i/o

I’m running Python 2.7 on a Linux machine, and by far the slowest part of my script is loading a large json file from disk (a SSD) using the ujson library. When I check top during this loading process, my cpu usage is basically at 100%, leading me to believe that I’m being bottlenecked by parsing the json rather than

Linux cut pattern from log file

i have json log file but theres not only json i need to cut/remove everything what isnt json, structure looks like this: i tried cut -d command but it doesnt work for me Answer This did the work:

jq in shellscript: parse argument with ‘-‘

Here’s the json I need to parse: And my code to parse is like the following: The problem is this part: I can’t get the value of it and I guess the reason is that I didn’t pass $var correctly? I also tried But it doesn’t work..Maybe the tiny ‘-‘ in the “config-$val” made it special? So my question is

Advertisement