How to replace a string in multiple files using the command line

preview_player
Показать описание
Today we look at some powerful command line tools that can save you a lot of time.

Enjoy and let us know what other things you would like to see covered here on our channel ...

Рекомендации по теме
Комментарии
Автор

I was really missing a trick there: I have ag but still revert to egrep when I'm looking for files to do replacements in… as I'm watching I'm thinking what an idiot I am for doing it like that. Thanks Bob, perfect timing as I'm just getting things ready for Advent of Code 2021… I want to be a bit more prepared this year. LOL

GeoffRiley
Автор

That's cool and all BUT it will not work if the freaking files have spaces in their names! Unless you do this before running the commands:
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
That will set the file separator as a "carrier return" of sorts.
Oh those tools engineered when 8 characters were the standard length of file names! :)

nodupe