LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   grep to NOT select a word (http://www.linuxquestions.org/questions/programming-9/grep-to-not-select-a-word-84393/)

robertmarkbram 08-21-2003 11:33 PM

grep to NOT select a word
 
Howdy All!

How can I write a regular expression that will exclude a whole word.

Here is what I have now:

ls -a | grep "^[^\.]"

This lists out all files in the directory and removes all file names that begin with a destop. I then want to weed one other: a file called "Desktop". Can I use grep to select everything NOT "Desktop"?

Thanks for any advice!

Rob
:)

Dark_Helmet 08-21-2003 11:44 PM

grep -v pattern

robertmarkbram 08-21-2003 11:48 PM

Thank you.. errr.. Dark Helmet. :)

I shall check the man better next time!

Rob
:)


All times are GMT -5. The time now is 11:10 PM.