Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


regular expression swapping

Posted on 2004-08-27
Medium Priority
Last Modified: 2013-12-24

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

<cfquery name="test" datasource="firewall">
<cfoutput query="test">

text file---

2004-08-26 07:10:04 DROP TCP 1334 6667 48 S 1414859 0 8192 - - -
2004-08-26 07:10:12 DROP TCP 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 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


Question by:MorganStanley
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
LVL 21

Accepted Solution

pinaldave earned 152 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...

LVL 18

Assisted Solution

Plucka earned 148 total points
ID: 11962853
Hi MorganStanley,

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

Try pasting that into a page for an example.

LVL 21

Expert Comment

ID: 12192440
I suggest split between Pluka and myself.

Featured Post

Simple, centralized multimedia control

Watch and learn to see how ATEN provided an easy and effective way for three jointly-owned pubs to control the 60 televisions located across their three venues utilizing the ATEN Control System, Modular Matrix Switch and HDBaseT extenders.

Question has a verified solution.

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

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : All lightning effects with instructions : http://www.mediaf…
Suggested Courses

660 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