User Tools

Site Tools


blog:common_sed_taks

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Last revisionBoth sides next revision
blog:common_sed_taks [2009-07-29 18:17] – created brbblog:common_sed_taks [2009-07-29 18:17] 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/#00CC00/#9900CC/g   s/#00CC00/#9900CC/g
   s/#990099/#000000/g   s/#990099/#000000/g
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+You *might* have to type a tab instead of t here depending on your version of sed
   sed -r 's/^[ t]*//;s/[ t]*$//g'   sed -r 's/^[ t]*//;s/[ t]*$//g'
  
-  # Delete all occurances of foo+Delete all occurances of foo
   sed 's/foo//g'   sed 's/foo//g'
  
blog/common_sed_taks.txt · Last modified: 2009-07-29 18:18 by brb