试图找到我的文件中的数字可以被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