{"id":287,"date":"2022-08-25T22:03:42","date_gmt":"2022-08-25T13:03:42","guid":{"rendered":"https:\/\/auto.meto4d.pgw.jp\/blog\/?p=287"},"modified":"2022-08-25T22:03:44","modified_gmt":"2022-08-25T13:03:44","slug":"yq%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%80%81%e9%85%8d%e5%88%97%e5%86%85%e3%81%ae%e3%81%82%e3%82%8bkey%e3%81%8c%e7%89%b9%e5%ae%9a%e3%81%ae%e5%80%a4%e3%82%92%e6%8c%81%e3%81%a3%e3%81%a6%e3%81%84","status":"publish","type":"post","link":"https:\/\/auto.meto4d.pgw.jp\/blog\/?p=287","title":{"rendered":"yq\u3092\u4f7f\u3063\u3066\u3001\u914d\u5217\u5185\u306e\u3042\u308bKey\u304c\u7279\u5b9a\u306e\u5024\u3092\u6301\u3063\u3066\u3044\u308b\u5834\u5408\u306b\u305d\u306e\u914d\u5217\u5185\u306e\u5024\u3092\u5909\u66f4\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"\n<p>\u3059\u3063\u3054\u3044\u9577\u3044\u30bf\u30a4\u30c8\u30eb\u3002\u3067\u3082\u8868\u984c\u901a\u308a\u3002<br>yaml\u3067\u3053\u3046\u3044\u3046\u3053\u3068\u304c\u3057\u305f\u3044\u3093\u3060\u3051\u3069\u3001\u3063\u3066\u3068\u304d\u306b\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3068\u306b\u3089\u3081\u3063\u3053\u3057\u305f\u304c\u3059\u3050\u306b\u89e3\u6c7a\u3067\u304d\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u305d\u306e\u5099\u5fd8\u9332\u3068\u3057\u3066\u8a18\u8f09\u3002<br>\u3088\u304f\u8003\u3048\u308c\u3070\u5358\u7d14\u3002<br>\u306a\u304a\u3001yq\u306fjq\u306ewrapper\u3067\u306f<strong>\u306a\u3044\u65b9<\/strong>\u306eversion <strong>4<\/strong><br>\u3069\u3046\u3044\u3046\u3053\u3068\u304b\u3001\u8a73\u3057\u304f\u306f\u4ee5\u4e0b<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>yq\u306eversion\u306b\u3088\u3063\u3066\u7d50\u69cb\u9055\u3046\u306e\u3067\u305d\u3053\u3060\u3051\u6ce8\u610f<br>jq\u306ewrapper\u306ayq\u3082\u3042\u308c\u3070\u3001\u305d\u3046\u3058\u3083\u306a\u3044\u65b9\u306eyq\u3082\u3042\u308b<br>\u3058\u3083\u306a\u3044\u65b9\u306ever4<br><a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/mikefarah\/yq\" target=\"_blank\">https:\/\/github.com\/mikefarah\/yq<\/a><br>\u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u306f\u73fe\u6642\u70b9\u3067\u306e\u6700\u65b0\u30d0\u30fc\u30b8\u30e7\u30f3\u306e4.27.7\u3092\u5229\u7528\u3057\u3066\u3044\u308b<\/p>\n\n\n\n<p>\u3057\u305f\u3044\u3053\u3068\u306f\u3069\u3046\u3044\u3046\u3053\u3068\u304b\u306e\u5b9f\u4f8b\u3092\u898b\u308b\u3068\u308f\u304b\u308a\u3084\u3059\u3044<br>\u4ee5\u4e0b\u306e\u3088\u3046\u306ahttp\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u4f5c\u6210\u3059\u308bhttp.yaml\u304c\u3042\u308b<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;yaml&quot;,&quot;mime&quot;:&quot;text\/x-yaml&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;YAML&quot;,&quot;language&quot;:&quot;YAML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;yaml&quot;}\">http:\n  Header:\n  - Key: header1\n    Value: value1\n  - Key: header2\n    Value: value2\n  - Key: header3\n    Value: value3\n  Method: GET<\/pre><\/div>\n\n\n\n<p>\u3053\u3093\u306a\u611f\u3058\u3067http\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u751f\u6210\u3059\u308b\u305f\u3081\u306eyaml\u30d5\u30a1\u30a4\u30eb<br>\u3053\u308c\u306ehttp.Header[].Key\u304cheader2\u306e\u5834\u5408\u306eValue\u306e\u5024value2\u3092yq\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3063\u3066\u66f8\u304d\u63db\u3048\u305f\u3044<\/p>\n\n\n\n<p>\u7d50\u8ad6\u3068\u3057\u3066\u306f\u3053\u3046<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;Shell&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;shell&quot;}\">$ yq '.http.Header[] | select(.Key == &quot;header2&quot;).Value = &quot;hoge&quot; | [.] ' http.yaml | yq eval-all 'select(fileIndex==0).http.Header = select(fileIndex==1) | select(fileIndex==0)' http.yaml -<\/pre><\/div>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;yaml&quot;,&quot;mime&quot;:&quot;text\/x-yaml&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;YAML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;yaml&quot;}\">http:\n  Header:\n    - Key: header1\n      Value: value1\n    - Key: header2\n      Value: hoge\n    - Key: header3\n      Value: value3\n  Method: GET<\/pre><\/div>\n\n\n\n<p>\u4e0a\u66f8\u304d\u3059\u308b\u306a\u3089\u6700\u5f8c\u306eyq\u30b3\u30de\u30f3\u30c9\u306b -i \u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u8ffd\u52a0<\/p>\n\n\n\n<p>\u534a\u65e5\u8003\u3048\u3066\u89e3\u6c7a\u3057\u306a\u304b\u3063\u305f\u304c\u3001\u308f\u304b\u3063\u3066\u3057\u307e\u3048\u3070\u306a\u3093\u3066\u3053\u3068\u306a\u3044\u3002<br>select().key = &#8220;value&#8221; \u306a\u3093\u3066\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u306b\u7d44\u307f\u5408\u308f\u305b\u3066<br>.[]\u3067\u914d\u5217\u3058\u3083\u306a\u3044\u72b6\u614b\uff08\uff1f\uff09\u3067\u6e21\u3057\u305f\u5f8c\u3001\u307e\u305f\u914d\u5217\u306b\u3059\u308b\u305f\u3081[.]\u304c\u305a\u3063\u3068\u308f\u304b\u3089\u306a\u304b\u3063\u305f<\/p>\n\n\n\n<p>\u306a\u3093\u3067\u3067\u304d\u306a\u3044\u3093\u3060\u3068\u7d50\u69cb\u982d\u306b\u6765\u305f\u306e\u3067\u3053\u3046\u3084\u3063\u3066\u5099\u5fd8\u9332\u3068\u3057\u3066\u66f8\u3044\u305f<br>\u304c\u3001\u30d6\u30ed\u30b0\u3092\u66f8\u304d\u306a\u304c\u3089\u601d\u3063\u305f\u3002<br>\u305d\u3082\u305d\u3082\u306a\u3093\u3067jq\u306ewrapper\u3058\u3083\u306a\u3044\u65b9\u3067\u3084\u3063\u3066\u308b\u3093\u3060\u308d\u3046<br>jq\u306e\u65b9\u304c\u4e00\u822c\u7684\u3067\u3001jq\u30b3\u30de\u30f3\u30c9\u306e\u307b\u3046\u304c\u4f7f\u3044\u6163\u308c\u3066\u3044\u308b\u4eba\u304c\u591a\u3044\u3060\u308d\u3046\u304b\u3089\u3001yq\u3082jq\u306ewrapper\u306e\u65b9\u304c\u826f\u304b\u3063\u305f\u3060\u308d\u3046<\/p>\n\n\n\n<p>\u307e\u305f\u4eca\u5ea6\u306d\uff01<\/p>\n\n\n\n<p>\u306a\uff01<\/p>\n\n\n\n<figure class=\"wp-block-embed is-provider-youtube wp-block-embed-youtube\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"\u30b0\u30eb\u30fc\u30d7\u9b42 \u300e\u541b\u306b\u30b8\u30e5\u30fc\u30b9\u3092\u8cb7\u3063\u3066\u3042\u3052\u308b\u2665\u300fMV\" width=\"840\" height=\"473\" src=\"https:\/\/www.youtube.com\/embed\/xm-iWo2uEIM?start=200&#038;feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\n<\/div><figcaption><a href=\"https:\/\/www.youtube.com\/watch?v=xm-iWo2uEIM&amp;t=200s\">https:\/\/www.youtube.com\/watch?v=xm-iWo2uEIM&amp;t=200s<\/a><\/figcaption><\/figure>\n\n\n\n<p>200s \u304c\u7d20\u6674\u3089\u3057\u3044<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3059\u3063\u3054\u3044\u9577\u3044\u30bf\u30a4\u30c8\u30eb\u3002\u3067\u3082\u8868\u984c\u901a\u308a\u3002yaml\u3067\u3053\u3046\u3044\u3046\u3053\u3068\u304c\u3057\u305f\u3044\u3093\u3060\u3051\u3069\u3001\u3063\u3066\u3068\u304d\u306b\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3068\u306b\u3089\u3081\u3063\u3053\u3057\u305f\u304c\u3059\u3050\u306b\u89e3\u6c7a\u3067\u304d\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u305d\u306e\u5099\u5fd8\u9332\u3068\u3057\u3066\u8a18\u8f09\u3002\u3088\u304f\u8003\u3048\u308c\u3070\u5358\u7d14\u3002\u306a\u304a\u3001yq\u306fjq\u306ewrapper\u3067\u306f &hellip; <a href=\"https:\/\/auto.meto4d.pgw.jp\/blog\/?p=287\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;yq\u3092\u4f7f\u3063\u3066\u3001\u914d\u5217\u5185\u306e\u3042\u308bKey\u304c\u7279\u5b9a\u306e\u5024\u3092\u6301\u3063\u3066\u3044\u308b\u5834\u5408\u306b\u305d\u306e\u914d\u5217\u5185\u306e\u5024\u3092\u5909\u66f4\u3059\u308b\u65b9\u6cd5&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[17,10,12,5],"tags":[],"views":2235,"_links":{"self":[{"href":"https:\/\/auto.meto4d.pgw.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/287"}],"collection":[{"href":"https:\/\/auto.meto4d.pgw.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/auto.meto4d.pgw.jp\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/auto.meto4d.pgw.jp\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/auto.meto4d.pgw.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=287"}],"version-history":[{"count":3,"href":"https:\/\/auto.meto4d.pgw.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/287\/revisions"}],"predecessor-version":[{"id":290,"href":"https:\/\/auto.meto4d.pgw.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/287\/revisions\/290"}],"wp:attachment":[{"href":"https:\/\/auto.meto4d.pgw.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=287"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/auto.meto4d.pgw.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=287"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/auto.meto4d.pgw.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=287"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}