LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 08-17-2002, 02:23 PM   #1
mwtheobald
LQ Newbie
 
Registered: Aug 2002
Posts: 9

Rep: Reputation: 0
Question grep (possibly regex) question.


I have a text file with quite a few entries I want to delete out. I figured that using grep would be the best but unfortunately I cannot figure out how to get it to return lines without a search string....

For example if I want every line of a file that contained 2940 I would use
grep "2940" file.txt

But what I want is every line that DOESN'T contain 2940.... I found some information on a (?! ) operator but it doesn't seem to work...
grep "(?!2940)" file.txt
returns nothing.....

Any ideas?
 
Old 08-17-2002, 03:05 PM   #2
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 55
-v flag in grep excludes the pattern you specified
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Possibly a dumb question keeper70 Linux - Newbie 2 07-28-2005 09:14 AM
sed / regex question whysyn Linux - General 3 06-28-2005 02:11 PM
Possibly a silly browser question... ladyath Linux - General 2 12-10-2004 12:02 AM
stupid question possibly... derekn Linux - Networking 1 11-03-2004 10:42 AM
perl regex question JustinHoMi Programming 5 03-20-2002 07:46 AM


All times are GMT -5. The time now is 08:52 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration