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

x
?
Solved

generate report from log file

Posted on 2013-11-24
3
Medium Priority
?
252 Views
Last Modified: 2013-11-25
i have a log file and the only thing i need from it to generate a report is: discharge date & reason for discharge. the each block starts with sentence
Log-Date: mm/dd/yyyy.

in situation A, the result would be:
Discharge Date: 10/15/2012
Reason: Discharged to home or self-care (routine discharge).

and in situation B, the result would be:
Discharge Date: 10/15/2013
Reason: Discharged to home or self-care (routine discharge).
Discharge Date: 09/15/2012
Reason: Discharged to hospital.

situation A
Log-Date: 10/26/2012. Patient's record created. Admission Date: 08/01/2012   Log-Date: 06/20/2013 Patient Discharged. Discharge Date:10/15/2012 Reason for Discharge:01 - Discharged to home or self-care (routine discharge).  Log-Date: 06/20/2013 Discharge Undone. Discharge Date:11/15/2012. Original Admission Date: 08/01/2012

Open in new window


situation B
Log-Date: 10/26/2013. Patient's record created. Admission Date: 08/01/2013   Log-Date: 06/20/2013 Patient Discharged. Discharge Date:10/15/2013 Reason for Discharge:01 - Discharged to home or self-care (routine discharge).  Log-Date: 06/20/2013 Discharge Undone. Discharge Date:10/15/2013. Original Admission Date: 08/01/2013 Log-Date: 
02/26/2013. Patient's record created. Admission Date: 03/01/2013   Log-Date: 04/20/2013 Patient Discharged. Discharge Date:09/15/2012 Reason for Discharge:03 - Discharged to hospital. 

Open in new window


any help, comment or feedback would be deeply appreciated.
0
Comment
Question by:s_hausen
[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
3 Comments
 
LVL 35

Accepted Solution

by:
Terry Woods earned 1500 total points
ID: 39673646
I can't help with the CF code, but I can provide a regex pattern:

Discharge Date:(\d\d?/\d\d?/\d{4})\s*Reason for Discharge:\d* - ((?:(?!Log-Date:).)*)

Open in new window


The above pattern should capture your two values of interest into capturing groups, which hopefully you will know how to use with CF!
0
 
LVL 35

Expert Comment

by:Terry Woods
ID: 39673649
The pattern appears to pass testing here: http://www.myregextester.com/?r=e699fbe3
0
 

Author Closing Comment

by:s_hausen
ID: 39676600
helped me to solve the problem.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

688 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