[表示 : 全て 最新50 1-99 101- 201- 301- 401- 501- 601- 701- 801- 2ch.scのread.cgiへ]
Update time : 12/12 18:16 / Filesize : 255 KB / Number-of Response : 896
[このスレッドの書き込みを削除する]
[+板 最近立ったスレ&熱いスレ一覧 : +板 最近立ったスレ/記者別一覧] [類似スレッド一覧]


↑キャッシュ検索、類似スレ動作を修正しました、ご迷惑をお掛けしました

【.cmd】 バッチファイルスクリプト %15 【.bat】



267 名前:デフォルトの名無しさん mailto:sage [2023/05/06(土) 18:58:59.94 ID:l5Xh2UOq.net]
powershellで
$json_string = @'
[{"characterID": 1,"Level": 50, "Status": {"idx":1}},
{"characterID": 1,"Level": 100, "Status": {"idx":2}},
{"characterID": 2,"Level": 50, "Status": {"idx":3}},
{"characterID": 3,"Level": 50, "Status": {"idx":4}},
{"characterID": 3,"Level": 100, "Status": {"idx":5}}]
'@
$json = $json_string | ConvertFrom-Json
$json | group characterID | select @{N='ID';E={$_.Name}},@{N='MaxL';E={[int]($_.group | measure -Maximum Level).Maximum}} | %{ $id=$_.ID; $maxl=$_.MaxL; $json | ?{ $id -eq $_.characterID -and $maxl -eq $_.Level}}
出力結果
characterID Level Status
----------- ----- ------
1 100 @{idx=2}
2 50 @{idx=3}
3 100 @{idx=5}
バッチファイルから呼び出す場合
set FILENAME=test.txt
powershell -c "$json=gc %FILENAME% | ConvertFrom-Json; $json | group characterID | select @{N='ID';E={$_.Name}},@{N='MaxL';E={[int]($_.group | measure -Maximum Level).Maximum}} | %%{ $id=$_.ID; $maxl=$_.MaxL; $json | ?{ $id -eq $_.characterID -and $maxl -eq $_.Level}}"






[ 続きを読む ] / [ 携帯版 ]

全部読む 前100 次100 最新50 [ このスレをブックマーク! 携帯に送る ] 2chのread.cgiへ
[+板 最近立ったスレ&熱いスレ一覧 : +板 最近立ったスレ/記者別一覧]( ´∀`)<255KB

read.cgi ver5.27 [feat.BBS2 +1.6] / e.0.2 (02/09/03) / eucaly.net products.
担当:undef