Solved

regular expression swapping

Posted on 2004-08-27
6
133 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
  • 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

758 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now