Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Using wildcard metacharacters, how can you indicate a number is 1 or 2?

    Dear All,

    How can I indicate a number is 1 or 2? I have tried to find it from the textbook but it doesn't match to the answer. I only get the following stuff:

    These characters can simplify commands that specify more than one filename on the comand line, as you saw with the file command earlier. These wildcard metacharacters are interpreted by the shell and can be used with most comon Linux filesystem commands.

    Could you help me?

  2. #2
    Linux Guru Jonathan183's Avatar
    Join Date
    Oct 2007
    Try here ... search for wild card

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    I assume you refer to wildcards in a command-line interface? Here is an example:
    # The following line will output all files in local directory that have the
    # numbers 1 or two in their names.
    # The brace around the numbers indicates that the name must match
    # either a 1 or a 2 anywhere in the name.
    echo *[12]*
    # This will match names with any number from 0 thru 9 in the name.
    echo *[0-9]*
    # This will match names with 1 or 2 followed by any other number.
    echo *[12][0-9]*
    Is this what you are trying to figure out?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  4. $spacer_open
  5. #4
    Thank you for all your help.


Posting Permissions

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