Results 1 to 5 of 5

Thread: Metcharacters

  1. #1
    Join Date
    Dec 2011
    Beans
    46

    Question Metcharacters

    Sir,
    Please give me the patterns for the following using metacharacters

    1. All filenames consisting of two lower-case letters
    2. All filenames beginning with p and having a t somewhere

  2. #2
    Join Date
    Aug 2011
    Location
    47°9′S 126°43W
    Beans
    2,165
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: Metcharacters

    Quote Originally Posted by achuth View Post
    Sir,
    Please give me the patterns for the following using metacharacters

    1. All filenames consisting of two lower-case letters
    2. All filenames beginning with p and having a t somewhere

  3. #3
    Join Date
    Dec 2011
    Beans
    46

    Re: Metcharacters

    i am a tutor. For the first question the following command is showing wrong results
    ls *[a-z]*[a-z]*

    please help me on first question only

  4. #4
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,499
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Metcharacters

    in this case * means 'any sequence of chars including the empty one'
    <0+ chars>[a-z]<0+ chars>[a-z]<0+ chars>
    you get stuff that is at least 2 chars long because * will match anything over these two base characters. Drop *'s and you will get your 2chars long names
    Last edited by Vaphell; February 19th, 2012 at 03:52 PM.

  5. #5
    Join Date
    May 2006
    Beans
    1,787

    Re: Metcharacters

    Quote Originally Posted by achuth View Post
    i am a tutor. For the first question the following command is showing wrong results
    ls *[a-z]*[a-z]*

    please help me on first question only
    I wonder if tutor means the same to you as it does to me,

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •