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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:21:57+00:00 2026-05-28T02:21:57+00:00

So this command will replace abc with XYZ in file.txt in directory tmp sed

  • 0

So this command will replace abc with XYZ in file.txt in directory tmp

sed -ie ‘s/abc/XYZ/g’ /tmp/file.txt

How do you do a find and replace like this across a large number of files in a directory with a .html extension in one go?

  • 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-28T02:21:58+00:00Added an answer on May 28, 2026 at 2:21 am
    find /start/path -name *.html -exec sed -ie 's/abc/XYZ/g' '{}' \;
    

    As by your request, here is what it does:

    find /start/path -name *.html
    

    Finds all files that glob to *.html, starting in /start/path

    The -exec option tells find, to not just print out the files, but to run a command on them. Inside this command {} is replaced by the file. The -exec option hast to end with a semicolon, which we have to escape with a backslash, else bash will swallow it.

    Again, from the OP’s special situation: Put the following into a file called replaceabc.sh

    #!/bin/bash
    find '/home/129224/domains/sandpit.uk-cpi.com/html/sshit' -name '*.html' -exec sed -ie 's/abc/XYZ/g' '{}' \;
    

    then from the shell prompt

    chmod 700 /path/to/replaceabc.sh
    /path/to/replaceabc.sh
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This command and output: % find . -name file.xml 2> /dev/null ./a/d/file.xml % So
I have a command line like this: awk '$9 < 0.1' s_all_frq.txt | wc
I have this command that I run everyday via cron: find /home/get/public_html/videos -daystart -maxdepth
I have this command that I run every 24 hours currently. find /var/www/html/audio -daystart
I try this command to upload a file (standard.xml) into table book the file
Given the string string command = %ans[1]%*100/%ans[0]% Will replace to %ans[1]% to array[1] %ans[0]%
I'm using a sed command for replacing some words in text files. This command
Not sure if this is possible with a regular expression replace command, but I
I found that Windows command line redirection will replace '\n' with '\r\n' automatically. Is
I'm looking for a Unix command that will allow me to search/replace in a

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.