multiple files matching - wildcards - Questions

This is a discussion on multiple files matching - wildcards - Questions ; Hello! How to match files with 2 different extensions? For example I would like to see only *.h and *.cc files in the output of ls. I tried various combinations of brackets, *, | and nothing seem to work as ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: multiple files matching - wildcards

  1. multiple files matching - wildcards

    Hello!

    How to match files with 2 different extensions?
    For example I would like to see only *.h and *.cc files in the output of ls.
    I tried various combinations of brackets, *, | and nothing seem to work as I want...

    Anybody can help?

    cheers,
    mati

  2. Re: multiple files matching - wildcards

    marti wrote:
    > Hello!
    >
    > How to match files with 2 different extensions?
    > For example I would like to see only *.h and *.cc files in the output of ls.
    > I tried various combinations of brackets, *, | and nothing seem to work as I want...
    >
    > Anybody can help?
    >
    > cheers,
    > mati



    ls *.h *.cc


  3. Re: multiple files matching - wildcards

    On Wed, 18 Feb 2004 05:38:05 -0800, marti wrote:

    > Hello!
    >
    > How to match files with 2 different extensions? For example I would like
    > to see only *.h and *.cc files in the output of ls. I tried various
    > combinations of brackets, *, | and nothing seem to work as I want...
    >
    > Anybody can help?
    >
    > cheers,
    > mati


    ls | grep -E \.h$\|\.cc$

    --
    It's not that hard to understand the lesson of Viet Nam. Never never
    never never defend one tyrant against another, because The worst thing
    that can happen is you might win. The *Gulf* war was worse than Nam.
    D. Raleigh Arnold dra@ (http://www.) openguitar.com darnold4@cox.net

  4. Re: multiple files matching - wildcards

    "marti" wrote in message
    news:76a2c725.0402180538.72e327da@posting.google.c om

    > How to match files with 2 different extensions?
    > For example I would like to see only *.h and *.cc files in the output
    > of ls.
    > I tried various combinations of brackets, *, | and nothing seem to
    > work as I want...


    Match as many or as few as you like:

    $ ls *.cc *.h

    Also, you should keep in mind that the dot "." is just simply another legal
    filename character; there are no "extensions" in *nix. An "extension" is a
    MICROS~1ism, and is to a large extent the nature of the problems with that
    software.

    tony

    --
    use hotmail for any email replies



    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

  5. Re: multiple files matching - wildcards

    ynotssor wrote:
    > "marti" wrote in message
    > news:76a2c725.0402180538.72e327da@posting.google.c om
    >
    >
    >>How to match files with 2 different extensions?
    >>For example I would like to see only *.h and *.cc files in the output
    >>of ls.
    >>I tried various combinations of brackets, *, | and nothing seem to
    >>work as I want...

    >
    >
    > Match as many or as few as you like:
    >
    > $ ls *.cc *.h
    >
    > Also, you should keep in mind that the dot "." is just simply another legal
    > filename character; there are no "extensions" in *nix. An "extension" is a
    > MICROS~1ism, and is to a large extent the nature of the problems with that
    > software.
    >


    FYI: File extension existed before Bill Gates was born.

    /dan

+ Reply to Thread