Using '/s' as a part of pattern for grep command

Solution Verified - Updated -

Issue

  • We can use '/s' to match like space as a patterm for grep command. Like this:

    # cat hosts.sample 
    10.173.16.21    host1
    10.173.16.213   host2
    # grep "10.173.16.21\s" hosts.sample 
    10.173.16.21    host1
    
  • However, in the following case this pattern doesn't work as expected.

    # grep "10.173.16.213\s" hosts.sample 
    #
    
  • Why does the case display nothing? What is the correct pattern to do that?

Environment

  • Red Hat Enterprise Linux 5.4
  • grep-2.5.1-55.el5

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.