[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.9

How do I pass a complex regexp to Grep for Windows?

Asked by openhatch in Unix Operating Systems, Regular Expressions, DOS and Windows

Tags: grep windows command-line regex regular expression

Hi -

Regarding the version of grep distributed here, which I am running from the Windows XP command line:
http://pages.interlog.com/~tcharron/grep.html

If I run this command:
grep -S -"size" *.flam3

I get results okay (it prints every file name and line where there is
a match - which in my case is every *.flam3 file in the directory).

But if I run this command -
grep -S "(?<=size=")[0-9]+" *.flam3

I get this error:
E:\Program Files\Grep\grep.exe: : Not enough memory

(My grep install is on an E: drive and included in the windows global
PATH environment variable.)

According to this "PowerGREP" tool and "regexBuddy" software I'm
using, that regular expression -
(?<=size=")[0-9]+

- should match the first number after size=" (so it will match 800) in
the below:
time="0" size="800 592" center="-0.408976 -0.305538"

- and alternately, this expression
(?<=size="[0-9]+ )[0-9]+

- should match the second number (or 592) in the same area:
time="0" size="800 592" center="-0.408976 -0.305538"

What am I doing wrong, or what may be wrong?

Puzzling: I can get a match from this command (it outputs a 1, meaning "match found" -

grep -c "size=""" electricsheep.243.06908.flam3

or from this:

grep -c [0-9] electricsheep.243.06908.flam3

But again, not from that first problem regex mentioned.  I'm suspecting the problem has to do with either how to tell it to look for a quote mark, or how to set off the regex from the quote marks required around the expression.

Also, when I get it narrowed down to finding a match, I'll wonder how to display only the match text (not the whole filename and line that matches), as I'll be passing the whole thing into a FINDSTR function in a Windows batch file, like so:

FOR /F "usebackq tokens=* delims=*" %%X IN (`grep "matchtext" file.flam3`) DO      (
      SET var=%%X
      ECHO var is !var!
                                                                                                            )

Thank you!
[+][-]05/02/09 03:05 PM, ID: 24287827Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05/02/09 07:40 PM, ID: 24288481Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05/02/09 09:23 PM, ID: 24288671Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/02/09 09:46 PM, ID: 24288711Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/03/09 06:26 AM, ID: 24289823Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Unix Operating Systems, Regular Expressions, DOS and Windows
Tags: grep windows command-line regex regular expression
Sign Up Now!
Solution Provided By: HonorGod
Participating Experts: 2
Solution Grade: B
 
[+][-]05/03/09 08:38 PM, ID: 24292370Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/04/09 04:14 AM, ID: 24293946Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/04/09 04:17 AM, ID: 24293959Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/04/09 04:25 AM, ID: 24293995Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/08/09 03:48 AM, ID: 24334718Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 - Hierarchy / EE_QW_3_20080625