rsed is a recursive version of sed. It also solves a few of the other limitations of sed. They include:
- The ability to easily see which files will be changed ahead of time
- Save original files - in case you need them later
- Test your sed expressions easily
Usage:
rsed [OPTIONS] [files]
-c [current] search string
-r [replacement] replacement string
-t [directory] temporary directory
-v verbose mode
-q quiet mode
-nf do not exit on failure
-d delete files after operation is complete
-nocolor turn color off
If -c is specified but -r is not the script performs a test run without modifying any of the files.
rsed examples:
Here are some examples of how you can use the script:
rsed -c "^Tset"
Find files that contain the regexp: ^Tset
This does not change any of the files, it is considered a test run
rsed -c "^Tset" -r "Test"
Replace the occurances of ^Tset with Test
This modifies the file, and saves a copy of the original filename (by appending rsed to the filename)
rsed -c "^Tset" -r "Test" -d
Replace the occurances of ^Tset with Test
This modifies the file and deletes the original upon completion.
rsed -c "^Tset" -r "Test" -d -q -nocolor
Replace the occurances of ^Tset with Test
This modifies the file, deletes the original upon completion, runs in quiet mode, and displays no color
rsed -c "^Tset" -r "Test" -nf
Replace the occurances of ^Tset with Test
This modifies the file, creates a copy of the original, and it does not exit when it encounters a failure (such as not having the permission to modify a file).
Product's homepage