Score:0

Updating Web Pages - Struggling with SED

de flag

I have a bunch of domains that I need to update, the structure is basically the same but the individual page names are different.

Example:

root-directory/review/

In the /review/ directory, there are multiple pages with various name. I need to update the canonical name for all of the pages.

Example of name:

american-eagle-jeans.html       
men-jeans.html
american-eagle-mens-jeans.html  
mens-designer-jeans.html
athletic-fit-jeans.html         
mens-jeans-.html
best-jeans-for-men.html        
mens-jeans-brands.html
black-jeans-men.html            
mens-jeans-sale.html
buckle-jeans.html               
mens-jeans.html
designer-jeans.html 

The existing canonical looks like:

<link href="DOMAINNAME.com/index.html" rel="canonical"/>

It needs to be changed to the page name - example: designer-jeans.html needs to look like:

<link href="/designer-jeans.html" rel="canonical"/>

I tried a few different approaches but have been struggling to get it to work. With simple static fixes I have no issues

sed -i 's!DOMAINNAME/index.html!/designer-jeans.html!g' *.html

Please help

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.