Solved

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

Posted on 2007-11-15
2
8,050 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
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.

810 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