Link to home
Start Free TrialLog in
Avatar of moellert
moellert

asked on

Follow up question to: Q_21898085-Evaluating a text file

Idle Mind,

I have two follow up questions regarding your solution to my original "Evaluating a text file" question.

1. when the value is embedded in two quotation marks I have to remove the quotation marks, eg. image = "my image" -> should become key=image and value=my image

2. there is one complicate parameter added to the possible parameters. This one causes your script to crash. Here is the example:



AUTH= glogin \
auth [ default=ignore ] /lib/security/pam_setpw.so \
auth [ success=2 default=ignore ] /lib/security/pam_guest.so \
auth [ success=1 new_authtok_reqd=1 default=ignore ] /lib/security/inifile.so try_first_pass \
auth [ success=ok new_authtok_reqd=ok default=die ] /lib/security/pam_smb_auth.so use_first_pass nolocal \
auth [ default=ok ] /lib/security/pam_putregistry.so save_ini=/tmp/user.ini
AUTH_SMB.conf=domain=tm.com server=dc1 backupserver=dc2


AUTH= glogin \
auth [ default=ignore ] /lib/security/pam_setpw.so \
auth [ success=2 default=ignore ] /lib/security/pam_guest.so \
auth [ success=1 new_authtok_reqd=1 default=ignore ] /lib/security/inifile.so try_first_pass \
auth [ success=ok new_authtok_reqd=ok default=die ] /lib/security/pam_ldap.so use_first_pass \
auth [ default=ok ] /lib/security/pam_putregistry.so save_ini=/tmp/user.ini
LDAP.conf=SERVER=ldapsrv DCBASE=dc

What I need out these parameters (and these are actually only 5 parameters) is

key                                                  value
AUTH_SMB=domain                        tm.com
server                                               dc1
backupserver                                     dc2

LDAP.conf=SERVER                         ldapsrv  
DCBASE                                             dc


Could you help me here again?
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

For (1)...assuming you want to remove quotes on ALL entries:

Change:

    inputLine = inputLine.ToLower                          

To:

    inputLine = inputLine.ToLower.Replace(Chr(34), vbNullString)



For (2)...I'll post back later...I'm moving and trying to get ready for the packing company that is coming today.  =)

   
Avatar of moellert
moellert

ASKER

Here are two more parameters in the same format:

ICADrives=E=Floppy,rw,ycvdfs
ICAComports=COM2=COM1

In the first case E, Floppy, rw and ycvdfs as parameters
In the second case COM2 and COM1
I'm still "enroute" in my move and don't have access to VB.Net.  =(

I probably won't have my computer back up for another couple of weeks.

Hopefully someone else will jump in and give you a working solution before then.
Idle Mind, are you online again? Could you help me before the thread will be closed?
So basically you want to extract the data from only these two lines:

    AUTH_SMB.conf=domain=tm.com server=dc1 backupserver=dc2
    LDAP.conf=SERVER=ldapsrv DCBASE=dc

Do you want to simply ignore the rest of the lines from these two blocks?

If YES, then is it safe to ignore any line that begins with "auth" except for "AUTH_SMB"?

And is it safe to assume that any line beginning with "LDAP.conf" is the second line to be specially processed?
Yes, any line starting with "auth" (except auth_smb) could be ignored.
So, basically there are 4 conditions at the moment that need to be considered.

1) AUTH_SMB.conf=domain=tm.com server=dc1 backupserver=dc2
should result in
key                                                  value
AUTH_SMB=domain                        tm.com
server                                               dc1
backupserver                                     dc2

2) LDAP.conf=SERVER=ldapsrv DCBASE=dc
should result in
key                                                  value
LDAP.conf=SERVER                         ldapsrv  
DCBASE                                             dc

3) ICADrives=E=Floppy,rw,ycvdfs
should result in
key                                                  value
ICADrives                                         E
ICADrives1                                       floppy
ICADrives2                                       rw
ICADrives3                                       ycvdfs

4) ICAComports=COM2=COM1
should result in
key                                                  value
ICAComports                                    COM1
ICAComports1                                  COM2


If it is not possible to store one or more of the parameters I need at least the option that this complete line is ignored, eg. "ICADrives=E=Floppy,rw,ycvdfs" does not work then it should be ignored completely
We can handle all these cases.

I'm not seeing "ICADrives" or "ICAComports" in the two blocks you gave though.

Are these in different blocks?  Or lines by themselves?  Are there additional lines that need to be ignored?

etc...

=)
I've added these two parameter later in this thread (Date: 07/05/2006 02:12PM GMT)
Right...that's not a problem.

I was just wondering if those lines also have a "block" associated with them that needs to be ignored or if they are just single lines that need to be handled specially.
no they are just single lines
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You are the best. Please tell your wife that she is right with her flavor. Bubble Bobble is one of the best games ever. I have the original arcade game here in my office :-)

Do you like to do a second follow up on this thread?
I'll give her a shot...  =)
Do you like to do a second follow up on this thread?
Sure...you can post here or in a different question...doesn't matter to me.
As the new question is more difficult I would like to send you my source code. This way it is much more easy to explain what I need.
My email address is : thomas@moellerbernd.com
So, if this is OK for I will open a new Q and send you the code.
Unfortunately, communication via email is against the rules:
https://www.experts-exchange.com/help.jsp#hi99

What you can do, however, is upload the souce code to EE-Stuff:
http://www.ee-stuff.com/
Are you online now?
Yes...but I'm shutting my computer down right now and going to be bed....   ZZZZZZzzzzzzzzzz...

G'night!
Tell me when you are online again to exchange the files.
Idel Mind,

I have uploaded the code to my private server. Tell me when you are online and give the URL.

Thomas