Solved

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

Posted on 2007-11-15
2
8,027 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
2 Comments
 
LVL 45

Accepted Solution

by:
Kdo earned 50 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Join & Write a Comment

Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
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 a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

705 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now