![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| Guest | Adding data to a hash table I have imported a csv using import-csv $clcode = import-csv $csvlocation | select clcode $clcode results are a list of 6 digit numbers, for the next part of the script I need to add ',' to the end of the 6 digits, I have messed around with different methods and have been unable to figure out how to do it, easily. Please help ![]() Neil |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: Adding data to a hash table On Dec 28, 8:13 am, NeilOz <Nei...@xxxxxx> wrote: Quote: > I have imported a csv using import-csv > > $clcode = import-csv $csvlocation | select clcode > > $clcode results are a list of 6 digit numbers, for the next part of the > script I need to add ',' to the end of the 6 digits, I have messed around > with different methods and have been unable to figure out how to do it, > easily. > > Please help ![]() > Neil This should do the trick: for ( $i = 0; $i -lt $clcode.Length; $i++ ) { $clcode[ $i ] += "," } Jeff |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Adding data to a hash table import-csv creates a collection of objects with properties generated from your columns in the csv. so here i presume clcode is the name of that column.. then you could do something like this import-csv $csvlocation | foreach { $_.clcode += ',' } NeilOz wrote: Quote: > I have imported a csv using import-csv > > $clcode = import-csv $csvlocation | select clcode > > $clcode results are a list of 6 digit numbers, for the next part of the > script I need to add ',' to the end of the 6 digits, I have messed around > with different methods and have been unable to figure out how to do it, > easily. > > Please help ![]() > Neil |
My System Specs![]() |
| | #4 (permalink) |
| Guest | Re: Adding data to a hash table "NeilOz" <NeilOz@xxxxxx> wrote in message news:64A62FA8-4C54-49AC-9EEC-993ABB38D334@xxxxxx Quote: > I have imported a csv using import-csv > > $clcode = import-csv $csvlocation | select clcode > > $clcode results are a list of 6 digit numbers, for the next part of the > script I need to add ',' to the end of the 6 digits, I have messed around > with different methods and have been unable to figure out how to do it, > easily. $clcode = import-csv $csvlocation | select clcode | foreach {"$($_.clcode),"} This just uses string interpolation to convert the number into a string followed by the comma. -- Keith |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Sorting a Hash Table before outputting it to html | PowerShell | |||
| How to create a hash table from an array | PowerShell | |||
| Passing hash table by reference | PowerShell | |||
| Variable as hash table issue | PowerShell | |||
| How do I read a XML file into a hash table? | PowerShell | |||