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
ファイルの最初の 2 列を書き出すスクリプトが必要です。前もって感謝します。
一方通行 :
gc c:\temp\test.txt | %{ $line=$_.split(" ");write-host $line[0] $line[1]}
別の方法:
gc file.txt | Foreach-Object {$_.Split()[0..1]}