LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   grep (possibly regex) question. (https://www.linuxquestions.org/questions/linux-newbie-8/grep-possibly-regex-question-28140/)

mwtheobald 08-17-2002 02:23 PM

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?

neo77777 08-17-2002 03:05 PM

-v flag in grep excludes the pattern you specified


All times are GMT -5. The time now is 03:04 AM.