2017-03-10 7 views
1

これらのjsのコマンドを1つのjqコマンドで連結する方法はありますか?JQ |コマンドを連結する

jq 'map({a: .children[1].text, f: .children[0].text})' | \ 
jq 'map(select(.a != null))' | \ 
jq 'map(select(.f != null))' | \ 
jq 'map([.a, [.f,(.f | length)]])' | \ 
jq -c '.[]' 

ありがとうございます。おそらく

+0

。あなたの入力はどのように見え、出力はどのように見えますか?最初の近似では、フィルタ自体を接続するだけです: 'jq -c 'map(...)|マップ(...)|マップ(...)|マップ(...)| 。 [] ''。 – chepner

+0

それはうまくいった!どうもありがとうございました。 – Roger

答えて

1

jq -c '.[] | {a: .children[1].text, f: .children[0].text} | select(.a != null) | select(.f != null) | [.a, [.f,(.f | length)]]'

関連する問題