Solved

regular expression swapping

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

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 …
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 video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

615 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