Posted By

joe-bbb on 09/02/09


Tagged

search replace perl


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

icecreamboyy


search and replace


 / Published in: Perl
 

  1. perl -pi -e "s/<h4>Page(\s\d*\s)of(\s\d*)<\/h4>/<p class=\"right\">Page\1of\2<\/p>/g" */object/*.htm
  2.  
  3. //also
  4.  
  5. perl -pi -e 's/<li\sid=\"home\"><a\shref=\".*\/index\.html\">Home<\/a><\/li>/<li id=\"home\"><a href=\"\.\.\/\.\.\/\.\.\/\.\.\/">Home<\/a><\/li>/gcx' */*/*/*/index.html
  6.  
  7.  
  8. //also
  9.  
  10.  
  11. perl -pi -e 's/,\s:\@total_index\s=>\s\d\s//g' *.haml
  12.  
  13. removes
  14. , :@total_index => 5
  15.  
  16. from
  17. =partial('footer-series', :locals => {:@current_index => 1, :@total_index => 5 })
  18.  
  19.  
  20. NOTES:
  21.  
  22. escape @

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: joe-bbb on November 3, 2009

\s is for space \d for digit () is rembered by \1, \2 etc.

You need to login to post a comment.