jq print character inside output

前端 未结 3 1741
余生分开走
余生分开走 2021-01-22 12:11

I want print \"/\" separator inside output title.

curl  -s http://cd0a4a.ethosdistro.com/?json=yes \\
    | jq -c \'.rigs|.\"0d6b27\",.\"50dc35\"|[.         


        
3条回答
  •  悲哀的现实
    2021-01-22 13:02

    Since you already use string interpolation for that specific field, simply include the character you need (slash /) inside the string, like this:

    curl ... | jq -c '... [.version,.driver,.miner,"\(.gpus)/\(.miner_instance)"] ...'
    

    In your case (the complete line):

    curl -s http://cd0a4a.ethosdistro.com/?json=yes | jq -c '.rigs|."0d6b27",."50dc35"|[.version,.driver,.miner,"\(.gpus)/\(.miner_instance)"]|@csv' | sed 's/\\//g;s/\"//g' | gawk 'BEGIN{print  "version" "," "GPU_driver" "," "miner" "," "gpu"} {print $0}' | csvlook -I
    

提交回复
热议问题