Solved

regular expression swapping

Posted on 2004-08-27
6
175 Views
Last Modified: 2013-12-24
Hi!

I'm getting data from a text file as follows:

<cfquery name="test" datasource="firewall">
SELECT * FROM C:\INETPUB\WWWROOT\TESTELEK\LOGSS.TXT
</cfquery>
<cfoutput query="test">
#test.A#<br>
</cfoutput>

text file---

A
2004-08-26 07:10:04 DROP TCP 80.95.69.25 212.52.164.55 1334 6667 48 S 1414859 0 8192 - - -
2004-08-26 07:10:12 DROP TCP 62.90.113.99 212.52.164.55 6862 80 52 FA 2864325013 3846929612 32768 - - -  

Now I wish to create rows from these entries which I can use as a database. So to make it simple:

this is what I read from the text
2004-08-26 07:10:04 DROP TCP 80.95.69.25 212.52.164.55 1334 6667 48 S 1414859 0 8192 - - -
I want it in the db like this
Date row     Time row ... etc..
2004-08-26 07:10:04

Help?

B.
0
Comment
Question by:MorganStanley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 21

Accepted Solution

by:
pinaldave earned 38 total points
ID: 11914796
Hi MorganStanley,
 
you can probably use something like this....
ListGetAt(list, position [, delimiters ])
in your case
Date = ListGetAt(#test.A#, 1, ' ')
<cfset time = ListGetAt(#test.A#, 2, ' ')>
something like that...

also you can use loop but let me know if this works for you or not...

Regards,
---Pinal
0
 
LVL 18

Assisted Solution

by:Plucka
Plucka earned 37 total points
ID: 11962853
Hi MorganStanley,

<cfset test = "2004-08-26 07:10:04 DROP TCP 80.95.69.25 212.52.164.55 1334 6667 48 S 1414859 0 8192" />
<cfloop index="field" from="1" to="#ListLen(test, ' ')#">
    <cfoutput>#ListGetAt(test, field, ' ')#<br></cfoutput>
</cfloop>

Try pasting that into a page for an example.

Regards
Plucka
0
 
LVL 21

Expert Comment

by:pinaldave
ID: 12192440
I suggest split between Pluka and myself.
0

Featured Post

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question