![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
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 |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
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 |
|
#3
|
||||
|
||||
|
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]$" Cheers ZB |
||||
| Google The UNIX and Linux Forums |