Hi all,

 

I'm trying to do the most simple of things, so I can start writing in
Powershell instead of vbscript, but can't find a way to do it...
Basically I'm processing a large input stream (30k+ users from a remote
data source) of text, in two columns of Variable Name and Variable Data,
starting with a Unique ID, followed by 3 lines related to that ID, then
it repeats for the next user, e.g

 

ID            User1

FN          John

SN          Thomas

ID            User2

FN          Rick

SN          Rubin

.

Etc

 

What I want to do is group each variable per Unique ID and process them.
So I get something like

 

ID(1) = "User1"

FN(1) = "John"

SN(1) = "Thomas"

 

Simple, but as my columns don't have column headings, I can't find the
Powershell command to separate the Variable Name and Variable Data
string into variables I can use. This seems to be the universal example
of basic manipulation of columns, but the get-process command gives
column headers, which I don't have

 

$tring = get-process |select-object Name,VM -first 10

                "{0} is the second process, VM is {1}" -f
$tring[1].Name,$tring[1].VM

 

So I'm looking to isolate the Variables. I've tried using the
formatstring command, but I can't get it to return the entire variable,
only 1 character of text

 

$test = "ABCD EFGH"

$first = "{0}" -f $test[0]

echo $first

A

 

I need the whole word assign so, I'd like to do 

 

$test = "ABCD EFGH"

$first = "{0}" -f $test[<first word>] 

$second = ""{0}" -f $test[<second word>]

echo $first

John

echo $second

Thomas

 

Also these variables are of variable length, so 

 

$first = "{0}" -f $test[1-4] 

 

Wouldn't work. Help!?!

 

Many thanks,

 

Neal

 

P.S. My goal is to write something that will process the entire dataset
in Powershell. I can write the lot to a text file and do whatever I like
in vbscript, that's easy for me, but I'm trying to use Powershell in a
more intelligent way so that I don't have to store and process the data
locally. It may be that this 'online' method is too slow anyway, but I
want to try...

 

___________________________________________________________

 

Neal Palmer                                

Senior Technical Support Officer

 

Systems and Communications Services
Information Services Division
UWIC, Cardiff, Wales, CF5 2YB

 

UWIC Mysite
<http://mysites.staff.uwic.ac.uk/Person.aspx?accountname=CAMPUS\cc0078> 

___________________________________________________________

 

P SAVE PAPER - Please do not print this e-mail unless absolutely
necessary

 

 

 

 

 


~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to listmana...@lyris.sunbeltsoftware.com
with the body: unsubscribe ntsysadmin

<<image001.gif>>

Reply via email to