Random Linux+ Question #25

Discussion in 'Linux+' started by tripwire45, Jul 12, 2005.

  1. tripwire45
    Honorary Member

    tripwire45 Zettabyte Poster

    13,493
    180
    287
    You are on the command line on your Linux computer and are trying to locate files containing the words "Certforums" and "certforums" located somewhere in the current directory. You remember that the files begin with the letter "t" but you created several of them. You also want to determine which files contain "Certforums" with an uppercase "C" and which ones contain the same word with a lower case "c". You decide to use a regular expression to help with the search. Which of the commands below would give you the results you are looking for? Choose only one answer.

    1. grep (c|C)ertforums t*
    2. grep '(c|C)ertforums' t*
    3. grep '(c|C)ertforums t*'
    4. egrep (c|C)ertforums t*
    5. egrep '(c|C)ertforums' t*
    6. egrep '(c|C)ertforums t*'

    Answer later.
     
    Certifications: A+ and Network+
  2. nugget
    Honorary Member

    nugget Junior toady

    7,796
    71
    224
    I'll take number 1 thanks.
     
    Certifications: A+ | Network+ | Security+ | MCP (270,271,272,290,620) | MCDST | MCTS:Vista
    WIP: MCSA, 70-622,680,685
  3. tripwire45
    Honorary Member

    tripwire45 Zettabyte Poster

    13,493
    180
    287
    Answer time. Correct answer is number 5. Sorry, Nugget. The grep command doesn't work well with regular expressions so the egrep command would be preferred here. Also, you have to contain the regular expression in quotes so it's not interpreted by the shell. The wildcard is external to the quotes.
     
    Certifications: A+ and Network+

Share This Page

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.