0

I am used to working with single line output and can use $1 $4 $8 to specify certain items in that line, but I have never worked with multiple line outputs and would like to just print one line instead of all of it to a log file. Here is the output I am working with:

# bitcoind getinfo
{
"version" : 80100,
"protocolversion" : 70001,
"walletversion" : 60000,
"balance" : 0.00000000,
"blocks" : 352256,
"connections" : 0,
"proxy" : "",
"difficulty" : 49446390688.24143982,

"paytxfee" : 0.00000000,
"errors" : ""
}

I would like to print just the "balance" : 0.00000000," line to a log file, right now I have all of the output going to the log file with the time ran. I am just not sure how to print a line from an output that is not single line.

Why did I get a downvote, i am new to Linux and dont know every command out there

LinHost
  • 39
  • 5

1 Answers1

2

As @Hyppy stated you need to use grep in any of these ways:

  1. Against a file: grep balance filename
  2. At the end of a pipe: somecommand | grep balance
  3. With extended regex : grep -E '^"balance":'
moebius_eye
  • 1,092
  • 7
  • 21
alphamikevictor
  • 1,062
  • 6
  • 19