-
Notifications
You must be signed in to change notification settings - Fork 2
Adam Dobbs edited this page Nov 27, 2013
·
4 revisions
Stream Editor. Fast and simple using standard GNU Regular Expression Syntax.
A nice fact is that Vim uses very similar syntax for searching and replacing.
- Basic usage example:
echo hello world | sed 's/hello/good morning/'
Output:
good morning world
- Replace text in multiple files via grep:
grep -rl "string_to_match_in_files" somedirectory/ | xargs sed -i 's|string1|string2|g'
This can be further refined by piping from find
aswell.
- Possibly the most useful - A full description : http://www.grymoire.com/Unix/Sed.html