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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:43:40+00:00 2026-05-23T09:43:40+00:00

I have gotten comfortable using expressions in Vim to do replaces across large files

  • 0

I have gotten comfortable using expressions in Vim to do replaces across large files and would like to know what utility program to learn that will allow me to do such a thing across folders of files in a similar fashion.
What command line program for search and replace is most like vims and works across folders?

  • 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-23T09:43:40+00:00Added an answer on May 23, 2026 at 9:43 am
    sed -i.bak 's/foo/bar/g' * 
    

    will replace every foo with bar on every line in every file in the current directory in place and creates a backup file with .bak extension.

    So I’d look into sed. But… Vim is very capable:

    vim -c "bufdo!%s/foo/bar/g" -c "wqa" *
    

    is almost the same.
    bufdo! executes the following command (%s/foo/bar/g in this case => replace every foo with bar on every line (% is a special line address for every line)). wqa means: write all then quit. You can specify at most 10 -c switches to Vim, which will be executed in the specified order. So, basically this is Vim automation:

    1. open every file in the current dir => every file has its own buffer
    2. execute the substitution on every buffer
    3. then write the files and quit

    The only difference is the lack of backup file creation (which can be achieved easily with some .vimrc settings). But sed is faster.

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

Sidebar

Related Questions

I have gotten the gravatar service working on my site. But I would like
I have gotten everything working for my class in which I am using Tomcat
I have gotten a value, encoded like so: %3Cp%3E%0AGlobal%20Business%20Intensive%20Course%20%u2013% I noticed that one of
I have been using MacVim & have gotten used to it but my main
I have gotten to know my way around a few programming languages, and I'd
I have tried calling a windows program several ways and I have gotten the
Background I've written several production apps using Rails 2. I've gotten comfortable with it.
After developing for iOS for some time now, I have gotten comfortable with the
I have a Rails app using AuthLogic and have gotten it to the point
I have gotten a program Im working on to load some pictures and display

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.