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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:20:03+00:00 2026-05-31T20:20:03+00:00

I have a string, $server[‘fish_stick’] (disregard double quotes) I don’t know how to successfully

  • 0

I have a string, “$server[‘fish_stick’]” (disregard double quotes)

I don’t know how to successfully grep for an exact match for this string. I’ve tried many ways.

I’ve tried,

rgrep -i \$'server'\[\''fish'\_'stick'\'\] .

rgrep -i "\$server\[\'fish\_stick\'\]" .

rgrep -i '\$server\[\'fish\_stick\'\]' .

Is it single quotes that are causing my issue?
When I echo the first grep out it shows exactly what I want to search but returns garbage results like anything with $server in it.

Please help and explain, thank you!

  • 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-31T20:20:04+00:00Added an answer on May 31, 2026 at 8:20 pm

    The main problem here is that you are not quoting the argument being passed to grep. The only thing that needs to be escaped is \$ (if double quoted) and []. If you want the exact string (not using regex), just use fgrep (grep -F) which does exact string matching:

    grep -F "\$server['fish_stick']"
    

    Works on my system:

    $ foo="\$server['fish_stick']"
    $ echo "$foo" | grep -F "\$server['fish_stick']"
    $server['fish_stick']
    

    Using regex:

    $ echo "$foo" | grep "\$server\['fish_stick'\]"
    $server['fish_stick']
    

    Using regex and handling nested single quotes:

    $ echo "$foo" | grep '\$server\['\''fish_stick'\''\]'
    $server['fish_stick']
    

    Inside of single quotes, nested single quotes can not be not be escaped. You have to close the quotes, and then reopen it to “escape” the single quotes.

    http://mywiki.wooledge.org/Quotes

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

Sidebar

Related Questions

HI I have a URL var str:String = conn=rtmp://server.com/service/&fileId=myfile.flv or var str:String = fileId=myfile.flv&conn=rtmp://server.com/service/
When connecting to sql server, I have the hardcoded string (local). Is this a
I have a function in SQL server 2008 that takes a string: 'A,B,C,D' and
How to rewrite Webconfig connection string at runtime.I have input textbox for Server,UserName and
I have this method to transfer files using a FTP Server: private void TransferNeededFiles(IEnumerable<string>
I have a string coming from server which I am displaying on UILabel. It
I have a string coming from server. I am identifying a particular substring and
I have a question about type casting. I have the following JSON String: {server:clients,method:whoIs,arguments:[hello]}
I have a string server.ip=192.168.1.200 And I need to write the above statement completely
I have a string that I Gzip on the server and download to a

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.