blog:common_sed_taks
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
blog:common_sed_taks [2009-07-29 18:17] – created brb | blog:common_sed_taks [2009-07-29 18:18] (current) – brb | ||
---|---|---|---|
Line 16: | Line 16: | ||
Suppose we want to change a whole color scheme though, the best way is to use a sed script file like so: | Suppose we want to change a whole color scheme though, the best way is to use a sed script file like so: | ||
- | # sedscript - one command per line | + | sedscript - one command per line |
s/# | s/# | ||
s/# | s/# | ||
Line 22: | Line 22: | ||
... | ... | ||
- | # use sedscript with -f | + | use sedscript with -f |
sed -i -f sedscript *.css | sed -i -f sedscript *.css | ||
Line 28: | Line 28: | ||
Other Examples | Other Examples | ||
- | # Trim whitespace from beginning and end of line | + | Trim whitespace from beginning and end of line |
- | # | + | You *might* have to type a tab instead of t here depending on your version of sed |
sed -r 's/^[ t]*//;s/[ t]*$// | sed -r 's/^[ t]*//;s/[ t]*$// | ||
- | # Delete all occurances of foo | + | Delete all occurances of foo |
sed ' | sed ' | ||
Line 38: | Line 38: | ||
* http:// | * http:// | ||
* http:// | * http:// | ||
- | + | * Source: http:// | |
- | Source: http:// | + | |
blog/common_sed_taks.1248884229.txt.gz · Last modified: 2009-07-29 18:17 by brb