The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
| help | unix | grep (GNU grep) 2.5.1 | advanced regex syntax MykC UNIX for Dummies Questions & Answers 4 10-15-2009 11:52 AM
| help | unix | grep - Can I use grep to return a string with exactly n matches? MykC UNIX for Dummies Questions & Answers 7 10-13-2009 02:57 PM
MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else hariza Shell Programming and Scripting 4 09-18-2008 03:56 AM
grep and fetching lines after grep arghya_owen Shell Programming and Scripting 2 07-16-2008 08:25 AM
Make grep -c display like grep -n? Jerrad Shell Programming and Scripting 2 08-25-2006 01:20 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 10-24-2009
slicer4ever slicer4ever is offline
Registered User
  
 

Join Date: Oct 2009
Posts: 10
Question Grep -v, with -A or -B?

hello everyone, i'm taking a class on unix and linux, and have come across a problem that my teacher couldn't figure out either:

the testing file i'm using:

Code:
This is a test of grep
to see how inversion really works
and figure out the problem that the class is having
hopefully this works

so here's some things i've tried:

Code:
cat test|grep 'figure'
output:
and figure out the problem that the class is having

cat test|grep -A 1 'figure'
output:
and figure out the problem that the class is having
hopefully this works

and here's the problem:

cat test|grep -v -A 1 'figure'
output:

This is a test of grep
to see how inversion really works
and figure out the problem that the class is having
hopefully this works

so, why does grep behave like that?, i thought that the output would be:

Code:
 This is a test of grep
 to see how inversion really works

instead it acts like it broke, and outputs the entire file, any help is much appreciated
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:34 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0