Gossamer Forum
Home : Products : DBMan : Customization :

Can Anyone Help?

Quote Reply
Can Anyone Help?
This isn't a question directly related to DBMan, but it will affect how quickly I can process my old records to make the flat file for DBMan...

I have a guestbook script (Matt's CGI Guestbook) which adds entries to an .html file like so (it is all one line):

06/03/99 23:03 <a href="mailto:rusty55@prodigy.net">rusty55@prodigy.net</a> Colleyville TX USA<br><b>SGT></b> <b>Friese,</b> <b>James</b> 6026 73/77 MCRD San Diego Platoon 2029 Jun 73<p>

For the flat file I want it to look like this:

06/03/99;23:03;rusty55@prodigy.net;Colleyville;TX;USA;SGT;Friese;James;6026;73/77;MCRD San Diego;Platoon 2029;Jun 73

Since a lot of you seem to know what the heck you're doing with Perl, how can I parse each line then "print" it back out to a file to look like the one above?

Any help would be greatly appreciated. I have been manually going through each line (30,000 of them)!

AJ
TheFew.com
www.thefew.com


[This message has been edited by TheFew (edited May 01, 2000).]

[This message has been edited by TheFew (edited May 01, 2000).]
Quote Reply
Re: Can Anyone Help? In reply to
Try change the $db_delim variable configuration in the default.cfg file to the following:

Code:
$db_delim = '\;';

Regards,


------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.




[This message has been edited by AnthroRules (edited May 01, 2000).]
Quote Reply
Re: Can Anyone Help? In reply to
My final delimeter will actually be the pipe (|) symbol, but that wasn't what I was asking about. I know you can parse data in CGI scripts with strings to look for such as:

$tmp = $hash{$col};
$tmp =~ s/^\s+//g; # Trim leading blanks...
$tmp =~ s/\s+$//g; # Trim trailing blanks...
$tmp =~ s/\Q$db_delim\E/~~/og; # Change delimeter to ~~ symbol.
$tmp =~ s/\n/``/g; # Change newline to `` symbol.
$tmp =~ s/\r//g; # Remove Windows linefeed character.

I want to know if there is a way to parst the line from the guestbook script (in first message) to the delimeted line (also in first message).

Thanks,
AJ
Quote Reply
Re: Can Anyone Help? In reply to
It looks to me as though your fields are delimited by spaces in each record.

I thought I had an idea, but I don't know if it will work. There is a space in "San Diego." I thought you might be able to split the records into fields by the spaces, but I don't see how you can. There are varying numbers of fields, or at least the appearance of them, because some (probably not all) of the locations have spaces in them.

You may need to go through and change all of the spaces within fields to another character. Without doing that, I don't see how you can translate the records into something DBMan can use.


------------------
JPD