I'm trying to get a specific part of a command's output using bash. So when you run this command;
./xuez-cli getnetworkinfo
it gives you an output like this;
"localaddresses" : [
{
"address" : "snyc3vzezoch2jax.onion",
"port" : 41798,
"score" : 4
}
]
and from this output, I need to get this address, snyc3vzezoch2jax.onion
and put into into a text file or a variable.
The .onion
part always stay the same, although the characters before it will be different each time so I need a general solution to get the whole address.
I've tried ./xuez-cli getnetworkinfo | grep address
though it gave me this output;
"localaddresses" : [
"address" : "snyc3vzezoch2jax.onion",
and still couldn't find a way to paste this address
part into a text file or a variable.
How can I do that?