#jq コマンドで #JSON 配列の shift & push 的なことをやる ( 配列の最初の要素を最後に入れ替える例 )
-
.[0:1]
is first element of array -
.[1:]
is other elements of array exclude first element - we can concatenate arrays with plus operator
+
$ echo '[1,2,3,4,5]' | jq ".[1:] + .[0:1]"
[
2,
3,
4,
5,
1
]
Original by Github issue
Author And Source
この問題について(#jq コマンドで #JSON 配列の shift & push 的なことをやる ( 配列の最初の要素を最後に入れ替える例 )), 我々は、より多くの情報をここで見つけました https://qiita.com/YumaInaura/items/16a001b0f070150be8d5著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .