by pitccorp01 at 2013-04-11 12:59:28
Hi,by Nobody at 2013-04-11 13:16:44
I have an input file that has two fields without headings separated by whitespace, where the first field contains names and the second field contains numbers. For example,
[quote]
Anthony 14
Mike 9
John 21
Sally 10
Mary 9
Jenefer 71
[/quote]
How can I write a Powershell script that will loop through the input file and set each line (n) of the first field as $NAME.n and each line (n) of the second field as $NMBR.n, where .n=line count?
Thanks
Try this
$input = ".\testdata.txt"
$data = import-csv -path $input -delimiter " " -header "name","number"
$data