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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:01:24+00:00 2026-06-18T05:01:24+00:00

I am attempting to replace text data in a git repository using the git

  • 0

I am attempting to replace text data in a git repository using the git filter-branch functionality.

I wrote a simple script to search for various terms and replace them. It was running extremely slow. I had multiple lines of BASH code executing to customize my search results and replacement operation. I know my code was not very efficient. I decided to go ahead and try just my first line which should be semi-efficient. It’s still taking forever to walk through the code base.

Is it possible to use BASH or another simple approach to search through my files and executed Find & Replace operations in parallel to speed things up?

If not, are there any other suggestions on how to go about handling this better?

Here’s the Git command I’m executing:

git filter-branch --tree-filter "sh /home/kurtis/.bin/redact.sh || true" \
    -- --all

Here’s the code my command is essentially executing:

find . -not -name "*.sql" -not -name "*.tsv" -not -name "*.class" \
    -type f -exec sed -i 's/01dPassw0rd\!/HIDDENPASSWORD/g' {} \;
  • 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-18T05:01:25+00:00Added an answer on June 18, 2026 at 5:01 am

    git filter-branch cannot process commits in parallel, becouse it needs to know hash (id) of parent commit to calculate current hash.

    But you can speed up processing of each commit:

    Your code executes sed for each file. That is very slow. Use this instead:

    find . -not -name "*.sql" -not -name "*.tsv" -not -name "*.class" \
           -type f -print0 \
      | xargs -0 sed -i 's/01dPassw0rd\!/HIDDENPASSWORD/g'
    

    This version does exactly the same as yours, but sed is executed with as many files (arguments) as possible. Find’s “-print0” and xargs’s “-0” means “separe filenames with zero byte”. So there is no trouble when filename contains spaces, new lines, binary trash, etc.

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

Sidebar

Related Questions

I am attempting to replace multiple lines using sed on a Linux system Here
I am attempting to perform some text canonicalization to replace some contractions. Here is
I'm attempting to write a CompiledQuery using Linq-to-Entities that will replace a stored procedure
I am attempting to use mechanize to veiw and collect data from various websites.
I am essentially attempting to replace all of the footnotes in a large text.
I'm attempting to write find/replace code for Word documents using Word Automation through Interop.Word
I've currently got an issue. I'm attempting to format a block of text using
I'm attempting to find and replace a string of text, but it doesn't seem
I'm attempting to replace a pattern in all my .aspx and .ascx file when
I am attempting to do a quick replace of the 'innerHTML' of the 'code'

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.