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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:30:46+00:00 2026-06-09T18:30:46+00:00

I am looking to perform an operation with sed that appends to a specific

  • 0

I am looking to perform an operation with sed that appends to a specific part of a series of files like to:

sed -i "s/test:\n/&$(<test.file)/g" foo.txt

Is there a way I can take the output of a file or some BASH varaible and place it into sed for input into a file.

  • 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-09T18:30:47+00:00Added an answer on June 9, 2026 at 6:30 pm
    sed '/^test:$/{r test.file
    d}' foo.txt
    

    Should do the trick. Note that the literal newline after the filename is not necessary in all versions of sed, but is advisable. The r command reads the contents of the named file.

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

Sidebar

Related Questions

I'm looking to perform a REGEX on a MongoDB find query that only finds
I would like to perform an operation on an argument based on the fact
I am trying to perform a simple operation that i have done alot in
I am looking for XML/XHTML Java library/framework that can perform the following two tasks
I'd like to perform the expensive operation of cross product across two data sets
I'm looking to perform Microsoft Word automation -- straightforward stuff such as instructing Word
I'm looking to perform a conversion of the values in a Ruby hash from
Several databases I've been looking at recently implement a virtual machine internally to perform
I am working on a system that performs continuous integration and I am looking
I have recently been in a situation where I needed to perform an operation

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.