Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Logic is failing me.

Reply
 
Old 11-02-2008   #1 (permalink)
Jsimpson


 
 

Logic is failing me.

Being an admin and not a programer (and it is early on a sunday
morning *grin*), my logic is failing me. Hope someone can give me a
kickstart.

I have to csv's. I need to get a number from one and use it to lookup
a value in another and write it back to the first or make a whole new
list from the first...

I.E.:

list1.csv
SerialNumber,IDNumber,CompName
12345,,machine1
12346,,machine2
12347,2223,machine3

list2.csv
SerialNumber,IDNumber,User
12345,2221,user1
12346,2222,user2
12347,2223,user3

$list1 = import-csv .\list1.csv
$list2 = import-csv .\list2.csv

Then something along the line of:

foreach ($list1.SerialNumber in $list2.SerialNumber) {$list1.IDNumber
= $list2.idNumber)

Of course that is not right, but I hope some can help. Thanks.

JSimpson

My System SpecsSystem Spec
Old 11-02-2008   #2 (permalink)
Kiron


 
 

Re: Logic is failing me.

ipcsv .\list1.csv | % {
$x = $_.SerialNumber
$_.IDNumber = (ipcsv .\list2.csv |
? {$_.SerialNumber -eq $x}).IDNumber
$_
} | epcsv newList.csv -not

--
Kiron
My System SpecsSystem Spec
Old 11-02-2008   #3 (permalink)
Jsimpson


 
 

Re: Logic is failing me.

You rock Kiron! Thanks

On Nov 2, 11:59*am, "Kiron" <Ki...@xxxxxx> wrote:
Quote:

> ipcsv .\list1.csv | % {
> *$x = $_.SerialNumber
> *$_.IDNumber = (ipcsv .\list2.csv |
> * *? {$_.SerialNumber -eq $x}).IDNumber
> *$_
>
> } | epcsv newList.csv -not
>
> --
> Kiron
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Sign in logic Live Mail
Logic One entry in registry Vista General
Re: If and Elseif Conditional Logic PowerShell
If and Elseif Conditional Logic PowerShell
Logic 3 game controller Vista Games


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46