invent.life

  • hello
  • whoami
  • thoughts
  • sysadmin
  • artlab
Select Page

recursive search and replace (grep and sed)

greplinuxsed

h

by Bazyli Brzóska | March 4th, 2014 | Code & Security

Shell
1
grep -rl "original" .
…

Search and replace all files recursively

grepreplacing stringssedstrings

h

by Bazyli Brzóska | December 15th, 2013 | Code & Security

Shell
1
grep -rl matchstring somedir/ | xargs sed -i "s/string1/string2/g"

The g parameter at the end of the regex will replace globally – all instances of string1.…

  • Facebook
  • Twitter
  • RSS

Copyright © 2009-2019 Bazyli Brzóska.