How do i find and replace a string on command line in multiple files on unix?
相关问题
- Why should we check WIFEXITED after wait in order
- Is it possible to pass command-line arguments to @
- softlinks atime and mtime modification
- UNIX Bash - Removing double quotes from specific s
- Get unexpanded argument from bash command line
相关文章
- Making new files automatically executable?
- Reverse four length of letters with sed in unix
- Compile and build with single command line Java (L
- Extracting columns from text file using Perl one-l
- Problem with piping commands in C
- How to update command line output?
- Passing command line arguments to Java via ant bui
- How to execute another python script from your scr
I always did that with ed scripts or ex scripts.
The ex command is just the : line mode from vi.
Like the Zombie solution (and faster I assume) but with sed (standard on many distros and OSX) instead of Perl :
This will replace all foo occurences in your Python files below the current directory with bar and create a backup for each file with the .py.bak extension.
And to remove de .bak files:
with recent bash shell, and assuming you do not need to traverse directories
Using find and sed with name or directories with space use this:
there are many ways .But one of the answers would be: