LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-21-2003, 10:33 PM   #1
robertmarkbram
Member
 
Registered: May 2003
Location: Melbourne, Australia
Distribution: Cygwin, Windows XP
Posts: 69

Rep: Reputation: 15
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
 
Old 08-21-2003, 10:44 PM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
grep -v pattern
 
Old 08-21-2003, 10:48 PM   #3
robertmarkbram
Member
 
Registered: May 2003
Location: Melbourne, Australia
Distribution: Cygwin, Windows XP
Posts: 69

Original Poster
Rep: Reputation: 15
Thank you.. errr.. Dark Helmet.

I shall check the man better next time!

Rob
 
  


Reply



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
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 7 12-19-2015 01:03 AM
Microsoft Word won't word wrap Micro420 General 1 06-13-2005 04:36 PM
text select Abi Word thegreatgatsby Linux - Software 8 02-20-2004 03:51 AM
ps -ef|grep -v root|grep apache<<result maelstrombob Linux - Newbie 1 09-24-2003 11:38 AM
Viewers for Word, Word Perfect, etc. Claude Williams Linux - General 2 11-22-2001 04:01 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:58 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration