【.cmd】 バッチファイルスクリプト %15 【.bat】 (819レス)
1-

269
(1): 2023/05/06(土)18:58 ID:l5Xh2UOq(1/2) AAS
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}}"
1-
あと 550 レスあります
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ

ぬこの手 ぬこTOP 0.007s