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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:12:56+00:00 2026-06-03T22:12:56+00:00

This question is philosophically similar to a question that’s come up time and time

  • 0

This question is philosophically similar to a question that’s come up time and time again here:

  • Search and replace text in all files of a linux directory
  • How to search-replace content within files in Ubuntu Linux?
  • Linux search and replace a complex string

But they (with the exception of the last one) all deal with simple replacements. I have a somewhat large block of code which appears in many files (I wish copy/pasting source code was punishable by law), and I need to replace it.

Is there anything that will help me out here? I want to avoid “sed”ifying the block (as is done in the third similar question above) because that will take the better part of a day. If I have to temporarily install some particular text editor, so be 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-06-03T22:12:57+00:00Added an answer on June 3, 2026 at 10:12 pm

    The nice thing about your question is that you’re dealing with fixed strings rather than regular expressions…which makes the problem relatively simple. You could write something to do the job for you without too many problems.

    The solution I’ve linked to isn’t optimal, but it does work, and it doesn’t rely on matching only opening/closing lines (that is, it only replaces verbatim matches). The basic idea is:

    • Read in the file that defines what we’re looking for,
    • Read in the file that defines our replacement,
    • Iterate over all the other arguments, looking for the search string and replacing it with the replacement text
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question already has an answer here: What are Extension Methods? 5 answers Usage
This question is similar to this one How do I add options to a
This question has been asked many times before, but they all seem to relate
This question relates to a prior question which was answered for all practical purposes
This question concerns converting a floating point number that is less than abs(1) and
This question is about having a button and text box. And when you click
This is more of a philosophical question than anything, so give me your thoughts.
This one is almost a philosophical question: is it bad to access and/or set
This question is about programming small microcontrollers without an OS. In particular, I'm interested
This question seems to be the essence of several others on this forum. I

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.