[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2007-11-15
2
Medium Priority
?
8,124 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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

656 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