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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:17:34+00:00 2026-05-23T19:17:34+00:00

Well. Thanks for all your kindly help. I have learn from your that, to

  • 0

Well. Thanks for all your kindly help. I have learn from your that, to use a variable in sed we have to use ” ” instead of ‘ ‘. However, in my case , before i use ‘ ‘ and without variable, it works well. After using ” ” and variable ($title, $web, $desc) it doesn’t functioning anymore, what is the reason?? thanks.

Before

sed -i '0,/<item pop="N">/ { s/<item pop="N">/<item pop="N">\n <title>test1<\/title>\n <guid>test2<\/guid>\n <link>test3<\/link>\n <description><![CDATA[<p>test4<\/p>]]><\/description>\n <\/item>\n<item pop="N">/ }' /var/www/html/INFOSEC/english/rss/test.xml

After

sed -i "0,/<item pop="N">/ { s/<item pop="N">/<item pop="N">\n <title>News: $title<\/title>\n <guid>$web<\/guid>\n <link>$web<\/link>\n <description><![CDATA[<p>$desc<\/p>]]><\/description>\n <\/item>\n<item pop="N">/ }" /var/www/html/INFOSEC/english/rss/test.xml

I have run it separately instead of the whole script
it turn out the error -bash: ![CDATA[: event not found, actually i should not run it alone as i need to input something in the variable

  • 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-23T19:17:35+00:00Added an answer on May 23, 2026 at 7:17 pm

    You are using " inside the string. These characters need to be escaped.

    Also, it’s likely that your shell escapes the \ characters inside "", and not inside ''. You have at least two solutions:

    Either keep everything inside "" but replace \ with \\, and "s with \":

     sed -i "0,/<item pop=\"N\">/ { s/<item pop=\"N\">/<item pop=\"N\">\\n <title>News: $title<...
    

    Or mix the two; when you need to insert a variable, exit ', enter your variable inside "", and re-enter ':

     sed -i '0,/<item pop="N">/ { s/<item pop="N">/<item pop="N">\n <title>News: '"$title"'<...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a show/hide toggle working well in multiple instances (thanks to help here
(More package/component install fun for me -- thanks everyone for all your help to
First of all thanks for taking your time to help me with this. Sorry
Well, my website can not redirect to https://www.facebook.com/QuaFootSpa from http://quafootspa.com/ I have tried redirection
I have code that supports both native C++ types as well as Qt types.
and thanks for your help I download the example of android book android 4
EDIT Thanks to all for your input. I guess my question was just a
Well to me Perl sometimes looks abit Abracadabra so many thanks for the patience
Hi guys thanks for pay attention to this. Well im trying to replace every
well i have a configuration like this in the components part of my config

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.