Jump to content

Find and replace in multiple files


Recommended Posts

Hi everyone, I just used wget -r to get all the files of a website and was wondering the best way to find and replace and a certain word that is present hundreds of times in the seventy files I extracted. To avoid doing this manually, I was wondering if I could do this in one attempt and avoid clocking many hours. There are multiple files of many types so I was wondering if there is an application that you guys might know that can do that. Thanks for your time.

Link to comment
Share on other sites

CMD can do this with;

sed s/[keyword]/[replacement]/g [filename] > [new filename]

BASH can do this with;

replacetext [filename] [keyword] [replacement]

where 'Keyword' is the word you wish to replace, 'filename' is the file(s) in which you want to change the keyword (wildcards allowed, e.g.; *.txt), and 'replacement' is what you want to amend the keyword to.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...