I have a html file that I'm trying to use sed
to automatically find a particular line and have this replaced but I am having no joy so far..
<div infinite-scroll='tabs[tabIndex].FeedService.loadFeed(false, tabs[tabIndex].FeedService.filters)'>
I would like to simply grab the entire line and replace to the following line using sed
<div infinite-scroll-labs="tabs[tabIndex].FeedService.loadFeed(false, tabs[tabIndex].FeedService.filters)" infinite-scroll-labs-container="window">
// my attempt..
sed -r --posix "infinite-scroll='tabs[tabIndex].FeedService.loadFeed(false, tabs[tabIndex].FeedService.filters, search.text, search.dateFrom, search.dateTo)' infinite-scroll-disabled='tabs[tabIndex].FeedService.busy || tabs[tabIndex].FeedService.noMoreResults || !tabs[tabIndex].active || tabs[tabIndex].FeedService.initialLoad' infinite-scroll-distance='1' infinite-scroll-immediate-check='false'\infinite-scroll-labs="tabs[tabIndex].FeedService.loadFeed(false, tabs[tabIndex].FeedService.filters, search.text, search.dateFrom, search.dateTo)" infinite-scroll-labs-container="window" app/feed.html > $cur_dir/www/feed.html
How is the best way to go about this?
If you're sure that's the exact line you want to change, then maybe this will work:
sed "s#^\(<div infinite-scroll\)='\(tabs\[tabIndex\]\.FeedService\.loadFeed(false, tabs\[tabIndex\]\.FeedService\.filters)\)'>\$#\1-labs=\"\2infinite-scroll-labs-container=\"window\">#"