Solved

regular expression swapping

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
IIS 8.5 (Windows 2012 R2) Problems Browsing Virtual Directories 15 170
SSL sertificate 5 71
How to stress test an ASP.NET https website 3 82
DNS @ Naked Domain Record 5 104
A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
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 …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

821 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