試圖找到我的文件中的數字可以被3整除。我怎樣才能讓我的每個循環讀取每個數字單獨?Powershell - 我該如何製作
this is my file:
6 9 7
-----
5 2 9
3 4 4
1 6 9
這是我到目前爲止的代碼:
function number{
param($b)
# Loop through all lines of input
foreach($a in $b){
if ($line = % 3)
{
Write-Output "divisible by 3"
}
else {
Write-Output "number not divisible by 3"
}
}
}
#Variables
#Get input from csv file
$a = Import-Csv "document 2.Dat"
非常感謝你的幫助!我應該更好地組織我的問題,我很抱歉。 $ line在我的腳本中是$ a,我必須在錯誤的時刻複製它。我可以部分地使我的腳本工作,因爲我先前加載了另一個文件。再次感謝您爲我解決這個問題! – SkullNerd