Solved

Last Script not working

Posted on 2014-07-24
4
126 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
[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
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How can I save all open docs into a given folder 12 127
Create Consolidation Sheet 3 45
Collapse and expand table in Word 2010 2 98
vb.net deleting excel sheet in workbook 11 32
I met Paul Devereux (@pdevereux) today when I responded to his tweet asking “Anybody know how to automate adding files from disk to a folder in #outlook  ?”.  I replied back and told Paul that using automation, in this case scripting, to add files t…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

749 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