All Questions
31 questions
0
votes
5
answers
173
views
How to add content to a file before the last } character using Busybox utilities?
There is a file with contents
{
"first_name": "John",
"last_name": "Smith",
"is_alive": true,
"age": 27,
"address": {
...
2
votes
2
answers
137
views
How can I select only successful values from leakcheck output?
I have these results that came from leakcheck. How do I properly exclude "false" results and still include the email using bash
[email protected]
{"success":false,"error":&...
0
votes
1
answer
113
views
How do I find and replace something AFTER a specific term in a terminal output
I need to run blkid and copy a specific UUID after a specific known partition name.
Then, I need to paste this into an exists config file, replacing a UUID that it's already there (parent_device_uuid)....
2
votes
1
answer
2k
views
How to get specific fields of JSON objects for which another field is true
I want to get a specific info from the below command
[root@test opc]# /bin/oci compute instance list-vnics --instance-id ocid1.instance.oc1.ap-mumbai-1....
0
votes
1
answer
78
views
How do I extract the content of quoted strings of a specific property path from an output?
I have an output from a web server response in JSON which looks like this:
{"status":"OK","result":{"string":{"variable":0},"string2":[{&...
0
votes
3
answers
2k
views
Regex to match JSON in an HTML
From this JSON-HTML webpage I want to filter out only lines with this pattern:
"realname": "SOME_VALUE_COMES_HERE",
I tried this:
curl https://www.mediawiki.org/w/api.php?action=...
2
votes
1
answer
2k
views
How to grep from file names with number in range
Assume I have a directory with 5,000 files. each with a name such as:
1.json
2.json
3.json
..
4000.json
4001.json
what command-line utility can I use to grep for a string from only the files 1.json ...
0
votes
3
answers
562
views
Search for pattern and create file with the same name
Here's a simple line of my usage:
grep -i '"location_country":"country name"' file.txt >> sample.txt
I'm searching a large file with multiple countries and what I would like ...
5
votes
1
answer
121
views
Search, separate, and purge txt values
What's really tripping me about this is the quote marks.
I have a file.txt with lines like:
{"a":"town, state, country","e":["[email protected]"],"n":&...
-2
votes
5
answers
3k
views
How to read list in JSON file using awk and sed
I have a list in JSON file apps.json:
{
"properites":{
"apps":["apple","orange","mango"]
}
}
I need to read this file and get of objects.
I used:
...
0
votes
1
answer
3k
views
Find and replace based upon pattern in JSON
Based upon URL I need to find uri like Test123.elb.us-east-1.amazonaws.com and change the connectionId from hkl876 to xed763
For example: locate Test999.elb.us-east-1.amazonaws.com and update ...
0
votes
5
answers
180
views
How to parse a line which has a number after a certain string greater than a threshold?
I have a file (list_20.txt) that looks like this:
[{"d_prime":"0.475425","variation1":"rs909776","r2":"0.057940","variation2":&...
2
votes
1
answer
13k
views
How do I extract value of a JSON key using bash shell?
I'm using bash shell. I would like to include something in my shell script that can extract the value of a certain key in a JSON string ...
davea$ json='{"id": "abc", "name": "dave"}'
I tried "grep"...
0
votes
2
answers
171
views
How to filter only particular lines from a file?
I have a file which has following lines. I just was to see IP address which is the first line, second line country only once and the score line only once but the score line should be the highest value ...
0
votes
1
answer
6k
views
Read a json file and run a command in Bash
I wanna block a mac address which downloaded value is over "20480":
The json file:
{
"client_length": 3,
"clients": {
"ac:07:5f:77:40:e9": {
"id": 1,
"ip": "192.168.5.40",
...