Solved

Last Script not working

Posted on 2014-07-24
4
117 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks a lot!!
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Script to copy or move mouse-selected collection of files plus targets referenced by shortcuts (.lnk) The purpose of this article is to help illuminate the real challenges and options available (where they may exist) for utilizing simple scriptin…
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 …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now