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

The Archive Base Latest Questions

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

sed -i /xxxxxxxxxxxx/r inc-sausage git.html sed -i /xxxxxxxxxxxx/d git.html First I insert the content

  • 0
sed -i "/xxxxxxxxxxxx/r inc-sausage" git.html
sed -i "/xxxxxxxxxxxx/d" git.html

First I insert the content of inc-sausage when xxxxxxxxxxxx is found

Second I delete xxxxxxxxxxxx

Both commands do exactly what I want. But how can I combine both sed commands to a single one?
I tried

sed -i "s/xxxxxxxxxxxx/r inc-sauasge" git.html
  • 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-27T15:09:52+00:00Added an answer on May 27, 2026 at 3:09 pm

    For starters, you coould concatenate both sed commands into one line and avoid repeating the search string, like this:

    sed -i -e "/xxxxxxxxxxxx/r inc-sausage" -e "//d" git.html
    

    Also, if you want to delete xxxxxxxxxxxx only and not other things in its line, you could do that instead:

    sed -i -e "/xxxxxxxxxxxx/r inc-sausage" -e "s///" git.html
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to use sed to insert a line after [Block B] in the
Using sed what is an one liner to print the first n characters ?
The sed below will output the input exactly. What I'd like to do is
Using sed , I would like to extract STRING between the first occurrence of
In sed , is it possible to skip the first n lines when applying
I just found this: sed '/label/{n;n;s/{}/{some comment}/;}' The intended effect is to seek label
I have 3 sed commands: sed -n 's/.*domain=\([^&]*\).*sdk_ver=\([^&]*\).*/\1 \2/p' inputfile > outputfile sed -n
From the sed documentation: d Delete the pattern space; immediately start next cycle. What
I use this command: sed -i 10 i \t\t\ttime.sleep(0.1) /home/test_file to insert at line
How would I use sed to delete all lines in a text file that

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.