The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
list the files but exclude the files in subdirectories shyjuezy UNIX for Dummies Questions & Answers 8 10-15-2008 10:42 AM
Photoplus: Auxiliary Information for Printed Images Based on Distributed Source Codin iBot UNIX and Linux RSS News 0 01-22-2008 08:20 PM
du (exclude files) the_learner UNIX for Advanced & Expert Users 1 07-17-2007 11:06 AM
Exclude & Zip dreams5617 Shell Programming and Scripting 1 02-11-2007 05:01 PM
lp - order of files printed mabrownawa UNIX for Advanced & Expert Users 2 02-16-2004 09:08 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 09-18-2005
Registered User
 

Join Date: Aug 2005
Posts: 229
How to exclude files from printed results

Hello
I have application that part of its command I can get list of files to the stout . with the path .
like :
./blah/blah/foo.c
./blah11/blah11/foo11.c
./blah12/blah12/foo11.h

now I will like to filter this result and for instance see the "*.h" file or the "*.c" file or only the files that starts with foo
Thanks
Reply With Quote
Forum Sponsor
  #2  
Old 09-18-2005
Registered User
 

Join Date: Sep 2005
Posts: 4
pipe through grep

if you pipe to grep -v what you dont want you will get the desired effect.

ie if you didnt want to see files called foo.c you would grep -v foo.c and get the following output:

./blah11/blah11/foo11.c
./blah12/blah12/foo11.h
Reply With Quote
  #3  
Old 09-18-2005
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
But if you wanted files that start with foo, can contain anything else, and end in .c or .h, then use a regular expression to grab what you want.

e.g.
Code:
my_command_that_produces_some_output | grep "/foo.*\.[ch]$"
Either way, grep is what you want.

Cheers
ZB
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:58 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0