?
Solved

How to use UNIX grep for find something wihch is not equal

Posted on 2007-11-15
2
Medium Priority
?
8,110 Views
Last Modified: 2010-04-21
I have a text file which has follwing lines;

asdada  ....      B=0
rwer    .....       B=233
gsggw .....     B=0
asfasf ....      b=234
.........................
..........................
.........................

How to use grep to get lines Which are NOT B=0. This means all lines which B>0

0
Comment
Question by:unknown_routine
[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 Comments
 
LVL 46

Accepted Solution

by:
Kent Olsen earned 200 total points
ID: 20289747
Hi unknown_routine,

grep won't evaluate the line and show you lines where B>0, but it can scan the lines at tell you where the string 'B>0' exist.  Or, as you seem to want where a string doesn't exist.

# find all lines with B=0

grep 'B=0' myfile

# find all lines that do not contain B=0

grep -v 'B=0' myfile

# find all lines with B>0

grep 'B>0' myfile



Good Luck,
Kent
0
 
LVL 15

Author Closing Comment

by:unknown_routine
ID: 31409343
Good answer. With little midification it is what I need.
0

Featured Post

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month10 days, 5 hours left to enroll

762 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