[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grep help with cygwin

From: sdnabble
Subject: grep help with cygwin
Date: Wed, 2 May 2007 16:45:05 -0700 (PDT)

I'm not sre this is the right place to ask, so let me know if I should seek
help elsewhere. And yes, I read the manual and havew worked hard on this.
I'll explain what I am tryin to do with an example.

In File1.txt I have
Some_String_0 X0Y1;

In File2.txt I have
inst "Some_String_0" PLACED in X0Y1;
inst "Some_string_1" PLACED in X2Y1;
inst "Some_string_2" PLACED in X3Y1;
A bad place for "Some_String_0"
A bad place for "Some_String_1"
A bad place for "Some_String_3"

I want to first parse through File1.txt and find all the lines missin the XY
information. Then find that same string in file2.txt that have the needed XY
information. And finally append the information to file1.txt or create a new
file3.txt with the needed information.

I decided to do this usng grep in my windows installation of cygwin. I
decomposed the porblem into parts and started by finding the matching
expression I am going to need form file1.txt to find in file2.txt.

grep "Some_String_" file1.txt | grep [^P]LACED > tempout.txt

Right away it didn't work. For some reason I can't say look for Some_String_
NOT containing the word PLACED. So I looked and looked through documentation
and could not figure out why this doesn't work. Isn't that how to use "NOT"?

I think I can make more progress if I get past this hurdle, If you are
interested in helping some more, I'd also like to know if I can really do
exactly what I want with just grep? Can I append stuff to file1.txt once I
get the needed XY information? And any other hints you can give me. Thanks. 

View this message in context: 
Sent from the Gnu - Grep mailing list archive at Nabble.com.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]