![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Nested for loop Hi! I am trying to run a nested for loop: $qqq = Import-Csv d:\work\abc.csv $uuu = Import-Csv d:\work\bbb.csv $qqq $uuu for ( $j = 0; $j -lt $qqq.length; $j++) { for($counter = 0; $counter -lt $uuu.length; $counter++) { ( $zzz = $uuu[$counter+1].eaname | where { $uuu[$counter].eaname -eq $qqq[$j].Pair } ) } $counter loop works fine but $j loop does not work. The $qqq.length is correct. Please point out what mistake(s) I made. pjo |
| | #2 (permalink) | ||||||||||||
| Guest | Re: Nested for loop Just Guessing: $qqq[$j+1].Pair Can you post the csv's or a sample ones? What exactly is not working with the $j loop ? ----- Shay Levi $cript Fanatic http://scriptolog.blogspot.com
| ||||||||||||
| | #3 (permalink) | ||||||||||||
| Guest | RE: Nested for loop What you are doing with the outside loop seems correct in that this works fine for me $qqq = import-csv songlist.csv for ($j=1; $j -lt $qqq.length; $j++){$qqq[$j].Song} The code that you posted is missing a closing } at the end. Not sure if that is your error or just missed on the post -- Richard Siddaway Please note that all scripts are supplied "as is" and with no warranty Blog: http://richardsiddaway.spaces.live.com/ PowerShell User Group: http://www.get-psuguk.org.uk "pjofx" wrote:
| ||||||||||||
| | #4 (permalink) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Guest | Re: Nested for loop On 3$B7n(B2$BF|(B, $B8a8e(B9:32, Shay Levi <n...@xxxxxx> wrote:
abc.csv is: Pair EURUSD GBPUSD USDJPY USDCHF USDCAD AUDUSD NZDUSD GBPJPY GBPCHF EURJPY EURGBP EURCHF EURAUD EURCAD AUDCAD CHFJPY AUDJPY NZDJPY AUDNZD bbb.csv is: column name EURUSD 1. kqjdkajdhlkkd 2. tgenjil;l; 3.htyhdjiigf <U>GBPUSD</U>: 1.oriiuj 2.qegsrh 3.kjyf 4.ygbtfseb and so on maybe the <U> is causing the problem. Thanks. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | #5 (permalink) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Guest | Re: Nested for loop On 3$B7n(B2$BF|(B, $B8a8e(B9:43, RichS <Ri...@xxxxxx> wrote:
The missing } is a posting error. the real code has it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | #6 (permalink) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Guest | Re: Nested for loop I found it ! simple error ! the elements in the first csv must have the following format. <U>GBPUSD</U>: except fpr the first one or delete <U> and </U>: How do I do this ? bbb.csv is: column name EURUSD 1. kqjdkajdhlkkd 2. tgenjil;l; 3.htyhdjiigf <U>GBPUSD</U>: 1.oriiuj 2.qegsrh 3.kjyf 4.ygbtfseb and so on On 3$B7n(B2$BF|(B, $B8a8e(B9:59, pjofx <asao.ishiz...@xxxxxx> wrote:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | #7 (permalink) | |||||||||||||||||||||
| Guest | Re: Nested for loop You can try regular expressions to extract/replace unwanted characters. ----- Shay Levi $cript Fanatic http://scriptolog.blogspot.com
| |||||||||||||||||||||