Quantcast
Channel: Replace string in multiple files using find and sed - Unix & Linux Stack Exchange
Browsing all 3 articles
Browse latest View live

Answer by Göran Uddeborg for Replace string in multiple files using find and sed

You can use any delimiter using sed too (not only with perl as @vesa-karjalainen suggested), e.g. find . -type f -name "*.java" -exec sed -i 's:original:result:g' {} +

View Article



Answer by Vesa Karjalainen for Replace string in multiple files using find...

Escape the slash, writing \/ You could also do: perl -pi -e 's!original!result!g' *java using ! as a delimiter instead of /. This is a bit shorter than using find & sed.

View Article

Replace string in multiple files using find and sed

So I've arrived at the conclusion that for recursively replacing all instances of a string in directory (only for .java extensions files) I need to use find . -type f -name "*.java" -exec sed -i...

View Article
Browsing all 3 articles
Browse latest View live


Latest Images