playlist.txt" name="description" /> playlist.txt" />

replace old-link-url to new-link-url with sed


I'm writing a script in bash that would replace old-link-url to new-link-url my problem is that sed can't replace the url because of the slashes. If i put just some text it works.

my code

sed -e s/"$old_link"/"$new_link"/g wget2.html > playlist.txt


sed supports <em>any</em> character as separator, so if the pattern you are trying to replace contains /, use a different separator. Most commonly used are # and |

sed 's|foo|bar|g' input sed 's#foo#bar#g' input


Don't forget to put double quotes if you are using variables in sed substitution. Also, if your variable have / then use a different delimiter for sed. You can use _, %, |, # and many more.

So may be something like this would work -

sed -e "s_"$old_link"_"$new_link"_g" wget2.html > playlist.txt


  • insert to sorted position linked list
  • Convert all image links in a website directory (on mac)
  • How to play tracks from iPod music library with different volume than system volume using AVPlayer
  • Silverlight - protecting Content inside a network (DRM?)
  • AngularJS ng-option get index
  • jPlayer 2.2.0: display track title in separate div on page load
  • How do I get HTML corresponding to current DOM tree?
  • How do I pass the string value parameter of the selected list item from an auto-populated dropdown l
  • Meteor helpers not available in Angular template
  • Change multiple background-images with jQuery
  • Java: can you cast Class into a specific interface?
  • Ajax Loaded meta Tags
  • Display issues when we change from one jquery mobile page to another in firefox
  • Problems to linebreak with an int in JLabel
  • Apache 2.4 and php-fpm does not trigger apache http basic auth for php pages
  • AES padding and writing the ciphertext to a disk file
  • How to add date and time under each post in guestbook in google app engine
  • How to recover from a Spring Social ExpiredAuthorizationException
  • Updating server-side rendering client-side
  • How to extract text from Word files using C#?
  • Fill an image in a square container while keeping aspect ratio
  • MySQL WHERE-condition in procedure ignored
  • ILMerge & Keep Assembly Name
  • Can a Chrome extension content script make an jQuery AJAX request for an html file that is itself a
  • Symfony2: How to get request parameter
  • Weird JavaScript statement, what does it mean?
  • Large data - storage and query
  • jquery mobile loadPage not working
  • Web-crawler for facebook in python
  • WOWZA + RTMP + HTML5 Playback?
  • How to get icons for entities from eclipse?
  • trying to dynamically update Highchart column chart but series undefined
  • Proper way to use connect-multiparty with express.js?
  • Load html files in TinyMce
  • JaxB to read class hierarchy
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • java string with new operator and a literal