我想一次尝试使用对象可用的各种方法来分配变量。我不确定powershell中是否存在这种能力,但要让它发挥作用,还有很长的路要走:
function myFunction() {
$createArray = @(Get-Content $aFile)
$arrayWithoutCharacters = $createArray.replace('-', '')
return $arrayWithoutCharacters
}
相反,我想做:
$createArray = @(Get-Content $aFile::replace('-', ''))
但是我对powershell知之甚少,不知道为什么这不起作用。
样本输入:
f1d06a1b-0470-44f1-895c-be1fd8b92e1c
75417fc3-afce-4b30-ab24-d306540c4020
2b0b2515-192d-470a-9745-4a3fb7c0203a
5498abad-2816-4d28-92cc-c08a3dfce8e6
1c2a95a3-2f44-432b-a276-ea23ece8a351
e58eeb44-4119-477f-b192-bf272054c69e
79f342ab-66e7-42a7-8315-2677f99f20c5
df2af860-52cd-48e6-aaf5-579b2455276a
92f745a2-c314-4a42-998c-dd611478b9b3
c971a1b2-937d-4e35-bea6-1cde18e9450a
fe3053c7-cc35-4e94-b176-1e2a8e9c8c14
fc3856b2-d22f-4255-a4e6-c11f508c3b99
d88e7175-ba36-4179-8589-13080120e49a
98c62b24-a3dd-4843-ad1a-e08d95624f00
bee25d62-3828-44ef-9b60-502dc4f14c2b
b889c381-b194-434f-9af8-3626b4186601
0a3f2663-1b7e-48f1-854d-f62c5469434b
我想要的示例输出:
f1d06a1b047044f1895cbe1fd8b92e1c
75417fc3afce4b30ab24d306540c4020
2b0b2515192d470a97454a3fb7c0203a
5498abad28164d2892ccc08a3dfce8e6
1c2a95a32f44432ba276ea23ece8a351
e58eeb444119477fb192bf272054c69e
79f342ab66e742a783152677f99f20c5
df2af86052cd48e6aaf5579b2455276a
92f745a2c3144a42998cdd611478b9b3
c971a1b2937d4e35bea61cde18e9450a
fe3053c7cc354e94b1761e2a8e9c8c14
fc3856b2d22f4255a4e6c11f508c3b99
d88e7175ba364179858913080120e49a
98c62b24a3dd4843ad1ae08d95624f00
bee25d62382844ef9b60502dc4f14c2b
b889c381b194434f9af83626b4186601
0a3f26631b7e48f1854df62c5469434b