我有以下json文件:
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Concurrent (threadDelay)
import qualified Control.Concurrent.Async as Async
import qualified System.Process.Typed as Proc
import qualified System.Process as P
import qualified GHC.IO.Handle as H
main :: IO ()
main = do
print "starting"
(readEnd, writeEnd) <- P.createPipe
let p1 = Proc.setStdout (Proc.useHandleClose writeEnd) "echo -n 'foo'"
let p2 = Proc.setStdin (Proc.useHandleClose readEnd) "base64 -"
Async.concurrently
(threadDelay 1000 *> Proc.runProcess_ p2) -- with the delay, it works
-- (Proc.runProcess_ p2) -- that line will make the program hang forever
(Proc.runProcess_ p1)
print "done"
我正在使用jq并想获取“名称”为“ internal.mydomain.com”的对象的“ Id”值。
答案 0 :(得分:1)
在名称上使用select()
过滤器,并使用以下过滤器获取ID值
jq '.HostedZones[] | select (.Name=="internal.mydomain.com.").Id'