Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 08-17-2002, 03:23 PM   #1
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, 04:05 PM   #2
LQ Addict
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

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


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 10:14 AM
sed / regex question whysyn Linux - General 3 06-28-2005 03:11 PM
Possibly a silly browser question... ladyath Linux - General 2 12-10-2004 01:02 AM
stupid question possibly... derekn Linux - Networking 1 11-03-2004 11:42 AM
perl regex question JustinHoMi Programming 5 03-20-2002 08:46 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:29 PM.

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