script: fix missing dates automatically

This commit is contained in:
Morgan 2018-09-08 13:25:39 +02:00
parent f515b24d84
commit 4bcf3d3bb8
2 changed files with 262 additions and 256 deletions

510
README.md

File diff suppressed because it is too large Load Diff

View File

@ -2,5 +2,11 @@
current=$(date "+%Y")
for ((year=1900; year<=current; year=year+1))
do
grep "/$year/" README.md | grep -v "($year)"
grep "/$year/" README.md | grep -v "($year)" | grep -v " - (" | while read -r line
do
echo "$line"
replace=$(echo "$line" | sed "s/ - / - ($year) /g" | sed -e "s#\*#\\\*#g" | sed -e "s#\[#\\\[#g" | sed -e "s#\]#\\\]#g" | sed -e "s#/#\\\/#g")
orig=$(echo "$line" | sed -e "s#/#\\\/#g" | sed -e "s#\*#\\\*#g" | sed -e "s#\[#\\\[#g" | sed -e "s#\]#\\\]#g" )
sed -i.bak "s;$orig;$replace;g" README.md
done
done