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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:13:22+00:00 2026-05-30T03:13:22+00:00

I am using sed -e s/foo/$bar/ -e s/some/$text/ file.whatever to replace a phrase in

  • 0

I am using sed -e "s/foo/$bar/" -e "s/some/$text/" file.whatever to replace a phrase in a certain file. The problem is that the $bar string contains multiple special characters like /. So when I try to replace something in a text file using the following code…

#!/bin/bash

bar="http://stackoverflow.com/"

sed -e "s/foo/$bar/" -e "s/some/$text/ file.whatever

…then I get an error saying : sed: unknown option to s is there anything I can do about it?

  • 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-30T03:13:23+00:00Added an answer on May 30, 2026 at 3:13 am

    You can use any delimiter. s@some@SOME@ for example. Another good delimiter is vertical-bar. Other chars can work but have special significance for some contexts such as regular expressions.

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

Sidebar

Related Questions

I want to globally replace the string foo with the string bar, using sed.
I have a blacklist.txt file that contains keywords I want to remove using sed.
I want to replace multiples phrases in a file using sed -e. The problem
I am trying to replace certain functions using SED. Let say I have some
I have trouble using sed. I need to replace some lines in very deprecated
I'm using sed for windows to do search and replace on some javascript files,
I need an expression using SED or similar that will allow to retrieve text
I'm using sed -e s/\*DIVIDER\*/$DIVIDER/g to replace *DIVIDER* with a user-specified string, which is
I'm trying to find and replacing some text using sed. Specifically, I'm trying to
I am trying to change the values in a text file using sed in

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.