emAmazed / redlamp

Bloggie Bloggie
MIT License
0 stars 1 forks source link

Mac/Linux Command Line Q&A #11

Open emAmazed opened 9 years ago

emAmazed commented 9 years ago

Find and Replace a string in multiple files

I recently had to update the copyright info on my website. Instead of modifying through every single page, I found a way to do this by a single command.

grep -rl '2014' ./ | xargs sed -i 's/2014/2015/g'

For OSX: grep -rl '2014' ./ | xargs sed -i "" 's/2014/2015/g'

And done.

To disable Mac standby and poweroff time

sudo pmset -a autopoweroff 0 standby 0