Solved

regular expression swapping

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Coldfusion update database with CFLOOP 5 64
Reverse Proxy Server 6 82
Web server load balancing technologies and methods 3 91
AWS Advice on using WHM/cPanel 1 75
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…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

776 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