Solved

Last Script not working

Posted on 2014-07-24
4
124 Views
Last Modified: 2014-07-24
Hi,

 The previous script given to us in the below thread didn't work for the attached file.
http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_28460484.html#a40185645

Can someone please help?
Report-02.txt
0
Comment
Question by:pvsbandi
  • 2
  • 2
4 Comments
 
LVL 35

Expert Comment

by:Robert Schutt
ID: 40217942
The file you have attached here does not contain CR/LF line endings, only LF (0x0A). Probably a different source, a unix system instead of a windows system.

You can change the pattern on line 10 to accommodate for any combination of CR/LF, for example:
oRE.Pattern = "(1SIDFA1PD(?:\s|\S)*?JURISDICTION NUMBER: (\d{2})(?:\s|\S)*?NUMBER OF ACTION LOGS CREATED:.*[\r\n]{1,2})"

Open in new window

0
 

Author Comment

by:pvsbandi
ID: 40217982
Hi Robert,

  Great solution! Two questions though..
1. How could you figure out the endings are different?
2. What exactly is the meaning of the change you made?

Thanks again!
0
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 500 total points
ID: 40218003
I tried parts of the pattern and all parts were working right up until the very last bit: "\r\n"...

Then I looked at the example file with a hex editor and saw only line feed (character code 10, represented by the \n) at the end of the lines instead of 'normal' windows files that have carriage return as well (character code 13, represented by \r).

The "\r\n" in the original pattern means these 2 characters need to be there to make the match true. In the new version 1 of the characters is enough but they can both be present (I haven't tested that by the way!)

This means files from windows, unix or mac should all be accepted now by the script (and others actually like \n\r or \r\r but you will probably never encounter those).
0
 

Author Closing Comment

by:pvsbandi
ID: 40218144
Thanks a lot!!
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Hello again, all.  For those of you that have been following along, you'll know that this is my third article on this topic (though it is not Part III).  This article is sort of remedial, and probably the topic with which I should have started the s…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

840 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