LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] listing files

[ILUG] listing files

kevin lyda kevin at suberic.net
Mon Jul 16 12:10:19 IST 2001


On Mon, Jul 16, 2001 at 11:07:07AM +0100, Jerry Walsh wrote:
> You could also just do:
> 
> ls foo*[^re]c

no.  unless tcsh implements regexp's *really* weird, that means a
string beginning with foo, contains any number of chars for a while,
and then has a char that is neither r or e, and then the last char is c.
so the following starred files would be listed in your example:

* foo2c
  fooec
  foorc
  foo2.rec
  fooc

in reality what you should really use is grep:

    ls foo*c | grep -v 'rec$'

unless you're using something like zsh, i don't thing filename expansion
regular expressions are the way to go.  here it is in zsh - might work
in other shells:

    ls (foo(|?|??)c|foo*([^.][^r][^e]|.[^r][^e]|[^.]r[^e]|[^.][^r]e|.r[^e]|.[^r]e|[^.]re)c)

which lists the following files (but not foo2.rec):

    foo2.rrc  foo2c  fooc  fooec  foorc

kevin

-- 
kevin at suberic.net          "linux is a cancer"  --steve ballmer
fork()'ed on 37058400      "released 25 august 1991, linux is a virgo" --me
meatspace place: home       linux, not just a star-sign:
http://suberic.net/~kevin                             http://www.linux.com/




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell