Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

TCL(Tool Command Language) Scripting

Logical NOTs - continued


Hi,

Thank you for the previous responses, however I am still not getting
the required results.

Attempted to do the following.

unix:.*\M(WARN|NOTICE)\M(?!.*\Mcore\M.*$).*
AND
unix:.*(WARN|NOTICE).*(?!core).*

The file I am testing on has

1. unix: NOTICE This line has core in it.
2. unix: NOTICE This line does not have the expression.
3. unix: WARN This line has core in it.
4. unix: WARN This line does not have the expression.
5. unix: NOTICE Another line seperate from expression.

I would like to see all lines above where core is NOT in the line.
Which would
match lines 2, 4, 5.

With unix:.*(WARN|NOTICE).*(core) I can get all lines with 'core' in
them.
But attempting to do
unix:.*(WARN|NOTICE).*(!core)  - results in no lines returned.
unix:.*(WARN|NOTICE).*!(core)  - results in no lines returned.
unix:.*(WARN|NOTICE).*(?!core)  - with egrep and awk I get syntax
errors.

The saga continues........

Thank you for ANY assistance.
Craig.

On Jun 3, 6:48 pm, cabkiz_fam@hotmail.com wrote:

The reason that you get a syntax error with egrep and awk is that
they, like most regular expression engines, do not support assertions.
Assertions are a fairly recent innovation found only in a minority of
regexp implementations. Indeed, Tcl does not have the full set since
it has forward but not backward assertions. Regular expression engines
are by no means all the same.

Here is a Tcl expression that I believe does exactly what you want:

\munix\M:.*\m(WARN|NOTICE)\M(?!.*\mcore\M.*)

The \m and \M are used to ensure that the enclosed strings occur as
"words". The last part, the (?!.*core.*) is a negative forward
assertion. It asserts that the string from that point on does not
match ".*\mcore\M.*", that is, that it does not match a string
containing "core" as a word.

If I may blow my own horn a little, I checked this out using my
regular expression tool redet (http://billposer.org/Software/
redet.html).

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc