Search This Blog

sed: replace urls in a html file

  • The following command replaces all the url with http://www.example.com:
    sed 's|<a[^>]* href="[^"]*/|<a href="http://www.example.com|g'
    
  • The following command replaces http://123.com with http://456.com:
    sed 's|<a[^>]* href="[^"]http://123.com|<a href="http://456.com|g'
    

No comments:

Post a Comment