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 8315299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:06:03+00:00 2026-06-08T21:06:03+00:00

I am looking for lines that have an apostrophe in them and tried a

  • 0

I am looking for lines that have an apostrophe in them and tried a few expressions that seemed identical to me; however, some worked and others didn’t. Why did I get the following behavior:

egrep \' file      # works as expected

egrep "\'" file    # seems to return all lines

egrep "[\']" file  # works as expected

egrep '\'' file    # seems to be waiting for more input
  • 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-06-08T21:06:05+00:00Added an answer on June 8, 2026 at 9:06 pm

    Single vs. double quotes have differences when it comes to escaping. Put echo in front to see what actually gets sent to egrep:

    $ echo egrep \' file
    egrep ' file
    $ echo egrep "\'" file
    egrep \' file
    $ echo egrep "[\']" file
    egrep [\'] file
    $ echo egrep '\'' file
    >
    

    The last case is prompting for more input because you’re still within a single-quoted expression: it’s not an escaped quote (\') in single quotes (since that isn’t how you escape single quotes.) It’s a backslash between single quotes, with a trailing opening quote.

    Incidentally, to escape a single quote in a single-quoted string, use a construction like this:

    $ echo 'foo'\''bar'
    foo'bar
    

    What this is actually doing is putting a naked literal quote(\') between two single-quoted strings. These are then all implicitly concatenated together.

    I have no idea why "\'" matches all lines (but it indeed seems to.)

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

Sidebar

Related Questions

I have a program that scans a big file looking for some text. Here
I have 4 points that form some quadrilateral. The lines can't cross or anything
I am looping through a large text file and im looking for lines that
I have an app that is available from the Android Market. Some users have
First I would like to say that I have only worked with java for
I have a file whose lines are Italian words that end in [aiou]' gia'
I have a 2GB .txt file that has over 60 million lines of what
I am going through this book and have hit some examples that I am
I have an app on the App Store that is crashing. I have tried
Hopefully, this is an easy one. I have an array with lines that contain

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.