Negation

 
Thread Tools Search this Thread
Homework and Emergencies Homework & Coursework Questions Negation
# 1  
Old 03-23-2011
Negation

Hello, have anybody any idea, how to negate some expression?

I have code that greps somethnig and I want filter from it some results...How to make it?

IDontWantThisExpression=$1
grep 'some regex' | grep '$IDontWantThisExpression' testfile.txt

Thanks for any advices.

Faculty of Mathematics and Physics, Charles University in Prague, The Czech Republic, Ondrej Tichy, ms.mff.cuni.cz/~ticho6am
# 2  
Old 03-24-2011
Code:
grep -v <IDontWantThisExpression> filename

# 3  
Old 03-24-2011
yes! -v switch Smilie thanks Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Negation in Bash Globbing

$ ls -1 a.1 b.1 x_a.1 x_b.1 $ ls -1 * b.1 x_a.1 x_b.1 $ ls -1 ** a.1 b.1 x_a.1 x_b.1The last result is not as expected. Why? Thanks. (2 Replies)
Discussion started by: carloszhang
2 Replies

2. Shell Programming and Scripting

if statement negation

Hi all, I've been searching the internet and can't find an answer to this. Im trying to figure out how to negate a whole expression befor an if. I'll explain below. Let's say x=0 y=1 ] (this is false) I would like to negate this whole boolean condition. To negate the above... (4 Replies)
Discussion started by: rethymno19
4 Replies

3. Shell Programming and Scripting

Negation in "tr"

Is there an option for negation in the "tr" command? For eg: echo hi | tr "h" "i" will print "ii". But if I want to covert all characters that are not "h" to "j", how do I do that? Is there something like "!" in tr? Or any switch? Thanks, Prasanna (17 Replies)
Discussion started by: prasanna1157
17 Replies

4. UNIX for Dummies Questions & Answers

grep with negation in "if" statement

I have an "if" statement which checks for certain pattern in the file: if grep -i dblist.comdbg /bb/bin/rstrt then copydb else exit 1 fi How can I use the same statement with negation, checking if file does not exist, something like if ! grep -i dblist.comdbg /bb/bin/rstrt then ... (2 Replies)
Discussion started by: aoussenko
2 Replies

5. Shell Programming and Scripting

negation in find path

Guys, Pl suggest me how to ignore a path in find command... I am aware of using "!" for other option... but how can i use it like this exampl... I want to search something for in / but not in Pl help. Thanks.. (2 Replies)
Discussion started by: clx
2 Replies

6. Shell Programming and Scripting

Bitwise negation

I am taking an online course on Unix scripting. The topic is Unix arithmetic operators and the lesson is Logical and bitwise operations. It is not clear how much storage space Unix uses to represent integers that are typed. Bitwise negation caused me to question how many bits are used to... (3 Replies)
Discussion started by: dLloydm
3 Replies
Login or Register to Ask a Question