Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个文本文件,其中包含这样的行:
ADUALI 4751 random name ADWXLI 4757 random name
我需要一个写出文件前两列的脚本。提前致谢。
单程 :
gc c:\temp\test.txt | %{ $line=$_.split(" ");write-host $line[0] $line[1]}
其他方式:
gc file.txt | Foreach-Object {$_.Split()[0..1]}