1

I have been using IFTTT (if this then that) to notify me whenever some document gets uploaded on a CMS using RSS feeds, but the link that the CMS puts into the RSS feed has spaces and it interferes with the auto link shortening that IFTTT has. For example:

<div><b>Attachments:</b> <a href="http://blah.com/foo/bar/Important Announcement 5.doc">http://blah.com/foo/bar/Important Announcement 5.doc</a><br><a href=""></a></div>

gives me this in the IFTTT notifications:

Attachments: http://is.gd/abcdef Announcement 5.doc

I currently rehost the RSS feed using a bash script because IFTTT can't go through authenticated pages. How can I use sed to remove the spaces between those two string?

zhongfu
  • 113
  • 3
  • 1
    which two strings? please include input-> output example. – hovanessyan Sep 16 '12 at 07:15
  • possible duplicate of [replace a unknown string between two known strings with sed](http://stackoverflow.com/questions/10613643/replace-a-unknown-string-between-two-known-strings-with-sed) – tripleee Sep 16 '12 at 07:25
  • Urlencoding your input will help: http://stackoverflow.com/questions/296536/urlencode-from-a-bash-script – Gregor Sep 16 '12 at 07:26
  • Thanks for your help! After a bit of fumbling around with IFTTT, I found the option to disable automatic link shortening. – zhongfu Nov 21 '12 at 12:39

1 Answers1

0

Perhaps something like this might work:

awk -F '"' '{OFS="'"'"'"; gsub(" ", "%20", $2); print $0}'
Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
  • Thanks for your help! After a bit of fumbling around with IFTTT, I found the option to disable automatic link shortening. – zhongfu Nov 21 '12 at 12:37