Using sed I had a problem trying to match and delete blog entries from a txt file before creating a sitemap.xml file
# Contents of filename: # http://www.example.com/2008/10/article3.html # http://www.example.com/2009/11/article7.html #!/bin/bash hostName="www.example.com" hostTLD="$(echo ${hostName}|cut -d . -f 3)" # results in "com" sed -i '/\.'"${hostTLD}"'\/\([0-9]{4}\)\/\([0-9]{2}\)/d' filename
I cannot figure out how to match the year / month bits. I want to delete all rows containing ".TLD / year / month /"
I know that part of $ hostTLD works because I use it with a different match:
sed -i '/\.'"${hostTLD}"'\/category\//d' filename
source share