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 all files that contain a specific directory Sat510 SUN Solaris 7 04-17-2007 07:57 AM
List of files in sub directory along with their properties ravikirankethe UNIX for Dummies Questions & Answers 3 11-13-2006 02:19 PM
cp list of files into another directory pavan_test UNIX for Dummies Questions & Answers 4 05-08-2006 06:08 PM
list of files in one Directory venkyA UNIX for Dummies Questions & Answers 3 06-24-2005 01:49 PM
list directory without use ls command? ashamry High Level Programming 3 06-08-2004 01:17 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 03-10-2004
Registered User
 

Join Date: Mar 2004
Posts: 2
can we list other than c files in a directory with only 'ls' command?

Guys,
can anybody help me in the following........

I have different types(c files,ordinary text files etc) in a directory.
is there any way to list other than .c files using the 'ls' command only.

i tried with the following.

ls *.[!c]*.
its not listing the .c files,but at the same time not listing the files which ends with c [eg: filec]
is there anywhy to get it with only 'ls' command.

Thanks in advance....
Reply With Quote
Forum Sponsor
  #2  
Old 03-10-2004
flim flam flamma jamma
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
why not use grep?

venkat: did you ever work for a company in chicago, Illinois?
Reply With Quote
  #3  
Old 03-10-2004
Ygor's Avatar
Moderator
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,249
Try this...

ls !(*.c)

From man ksh....
Quote:
In addition to the notation described in regexp(5), ksh recognizes
composite patterns made up of one or more pattern lists separated from
each other with a |. Composite patterns can be formed with one or
more of the following:

?(pattern-list) Optionally matches any one of the given patterns.

*(pattern-list) Matches zero or more occurrences of the given patterns.

+(pattern-list) Matches one or more occurrences of the given patterns.

@(pattern-list) Matches exactly one of the given patterns.

!(pattern-list) Matches anything, except one of the given patterns.
Reply With Quote
  #4  
Old 03-12-2004
Registered User
 

Join Date: Mar 2004
Posts: 2
Ygor,
it worked well.thanks a lot for ur info.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 08:51 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