Generate missing permalinks for flatfiled wordpress
ls 201*/*/*/*/index.html| while read line;
do indexname=`grep ‘rel=”bookmark”‘ $line| sed ‘s/<h2><a href=”..\/..\/..\/..\///g’|sed ‘s/” rel=”bookmark” title=”.*//’| sed ‘s/%3Fp/\?/’`; echo “<html><head><title>Redirect</title><META http-equiv=\”refresh\” content=\”0;$line\”></head><body>Redirect to <a href=\”$line\”>$indexname</a></body></html>” > $indexname ;
done
Fix links in flatfiled doc on ancient pre-smart sed Unix.
grep -l html * | grep -v .html | while read line;do echo $line; cat $line| perl -pe 's/a href=\"\/repositories\/digirep\/index\/(.[^ ]*)"/a href=\"\/repositories\/digirep\/index\/$1.html"/'> $line.html; done