|
|
|||||||
I was able to use SHOWACLS and a txt file w/ a list of all servers and drives to script some information gathering, now I need to format the txt file to be a CSV to be usable in Excell.... The TXT file looks like the following.... :\sites\QEHO\Europe CPO\2002\monthend\01jan Everyone Full Control [ALL] N:\sites\QEHO\Europe CPO\2002\monthend\01jan\CPO Europe BUILTIN\Administrators Full Control [ALL] NT AUTHORITY\SYSTEM Full Control [ALL] QRTP\TSE_HYPERION_IEUR Change [RWXD] QRTP\TSE_HYPERION_ADMIN Change [RWXD] N:\sites\QEHO\Europe CPO\2002\monthend\01jan\other Everyone Full Control [ALL] so on and so forth (word wrapping may have occured) but in short what I have is line1 = path line2..x (until blank line is found) are the groups and associated permissions... What I need to do it parse the file and re-write it to be path,groupname,permission any tips are appreciated! |
||||||||
|
|
|||||||
Im sure (i hope) others will give their interpretation, but here`s a start. Probably will blow-up on the first pass. This is quite a parsing challenge: Oh yeah, this is kixtart 4.0 (substr) break on $filename = "m:\t.dat" ; uncomment for softcopy ; del "out.txt" ; $=redirectoutput("out.txt") if open(1,$filename) = 0 $line = readline(1) while @error = 0 if substr($line,2,1) = ":" $path = $line else if $line $split = instr($line,"\") if $split = 0 $split = instr($line," ")-1 else $split = $split + instr(substr($line,$split)," ") - 2 endif $group = substr($line,1,$split+1) $access = substr($line,$split+1) endif ?"$path,$group,$access" endif $line = readline(1) loop $= close(1) endif -Shawn [ 10 April 2002, 20:32: Message edited by: Shawn ] |
||||||||
|
|
|||||||
Oh yeah, you asked for tips ? 1) Don`t post these kinds of coding challenges on the board during the day. It tends to drive us kixters mad and we don`t get any real work done ! heheh 2) Seriously, unless your paths always contain drive letters and colons (?), and if those blank lines of yours before the path are consistent, I would probably recommend you leverage off those in the parsing (instead of the semi-colon like I did). -Shawn |