Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6320105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:54:51+00:00 2026-05-24T15:54:51+00:00

GNU grep 2.5.4 on bash 4.1.5(1) on Ubuntu 10.04 This matches $ echo this

  • 0

GNU grep 2.5.4 on bash 4.1.5(1) on Ubuntu 10.04

This matches

$ echo "this is a     line" | grep 'a[[:space:]]\+line'
this is a     line

But this doesn’t

$ echo "this is a     line" | grep 'a\s\+line'

But this matches too

$ echo "this is a     line" | grep 'a\s\+\bline'
this is a     line

I don’t understand why #2 does not match (whereas # 1 does) and #3 also shows a match. Whats the difference here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T15:54:52+00:00Added an answer on May 24, 2026 at 3:54 pm

    Take a look at your grep manpage. Perl added a lot of regular expression extensions that weren’t in the original specification. However, because they proved so useful, many programs adopted them.

    Unfortunately, grep is sometimes stuck in the past because you want to make sure your grep command remains compatible with older versions of grep.

    Some systems have egrep with some extensions. Others allow you to use grep -E to get them. Still others have a grep -P that allows you to use Perl extensions. I believe Linux systems’ grep command can use the -P extension which is not available in most Unix systems unless someone has replaced the grep with the GNU version. Newer versions of Mac OS X also support the -P switch, but not older versions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

GNU bash, version 4.1.5(1)-release-(i486-pc-linux-gnu) Ubuntu Linux 10.04 This prints var as 1234 and does
Given the input echo abc123def | grep -o '[0-9]*' On one computer (with GNU
This question specifies that -P allows GNU grep to grep for a tab grep
windows xp, gnu grep from http://gnuwin32.sourceforge.net/packages/grep.htm I have file with line breaks: test 123
I'm trying to build GNU grep, and when I run make, I get: [snip]
What GNU/Linux command-line tool would I use for performing a search and replace on
Running GNU Emacs 22.2.1 on Ubuntu 9.04. When editing python code in emacs, if
I use (GNU) fmt to format longer texts with nice (‘optimal’) line breaks. However,
I am running GNU bash, version 3.2.39(1)-release (x86_64-pc-linux-gnu). I have a specific question pertaining
I am trying to understand how grep works. When I say grep hello *.*

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.