[LINUX] Replace all at once with sed

Introduction

It's easy to replace words in each file with sed all at once, but it's troublesome to apply sed to multiple files at once, so I tried to find out how to do it all at once.

result

For example, if you want to change the description of http://www.ubuntu16.04 in all html files in the current directory to https://ubuntu18.04

 find . -name "*.html" | xargs sed -i 's;http://www.ubuntu16.04;https://ubuntu18.04;g'

It's okay. find xargs sed Please find out how to use each.

By the way, if you use this on Mac, an error may occur, so at that time

 find . -name "*.html" | xargs sed -i '' 's;http://www.ubuntu16.04;https://ubuntu18.04;g'

Try. I put a space and two single quotes after -i.

Recommended Posts

Replace all at once with sed
Send newsletters all at once with Gmail
Upgrade all at once including dependencies with pip
Replace / delete special symbols with sed
Convert memo at once with Python 2to3
How to save all Instagram photos at once
Update multiple tables at once with pandas to_sql
Convert multiple proto files at once with python
Get corporate number at once via gbizinfo with python
11. Replace tabs with spaces
Limits that can be analyzed at once with MeCab
Replace all flags written with short names in maya.cmds with long names
Replace built-in functions with mock at test time without DI
Download Wikipedia flag images all at once [Python] [Beautiful Soup]
Create multiple users with serial numbers at once with Ansible Playbook
Rsync multiple files at once
Replace printf later with LD_PRELOAD
[Python] I made a function that can also use regular expressions that replace character strings all at once.