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

Next revision
Previous revision
blog:common_sed_taks [2009-07-29 18:17] – created brbblog: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/#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'
  
Line 38: Line 38:
   * http://sed.sourceforge.net/sed1line.txt – Eric Pement   * http://sed.sourceforge.net/sed1line.txt – Eric Pement
   * http://www.catonmat.net/blog/sed-stream-editor-cheat-sheet/ – Peteris Krumins   * http://www.catonmat.net/blog/sed-stream-editor-cheat-sheet/ – Peteris Krumins
- +  * Source: http://eriwen.com/tools/get-sed-savvy-1/
-Source: http://eriwen.com/tools/get-sed-savvy-1/+
  
  
blog/common_sed_taks.1248884229.txt.gz · Last modified: 2009-07-29 18:17 by brb