Hello, On Mon, 14 Oct 2019 22:23:49 +0200 (CEST) "Jeanette C. via arch-general" <arch-general@archlinux.org> wrote:
Hey hey Silvio, hm this looks more like a challenge for a whole script. I can script, but I'm not always the most efficient.
Yes you right I had think it would be one line :). No worried I search not efficient, it will be only a help in the daily hobby project. Every time manuell run grep make sick on a computer which are build to make our life easier :)
If your .md files always look the same, i.e. there is always the exact line "date: yyyy-mm-dd" and you can be sure that one script folder will have all articles, because they are originally written in that language, I'd have an idea.
Yes this files are markdown text files with a header and the content text. --- title: "Title" date: 2019-10-15 tags: "Gesellschaft" shorttext: "" draft: false lang: de cover: "society" --- So date is in every file and ever in same format because the date formatting make hugo when build the pages.
Say your articles are all created in German: grep -e "date: 2019-10-1" content/de/blog/*.md >orig.list LINES=`wc -l orig.list | awk '{ print $2 }'` # get number of entries # do the same for the ohter folders: grep -e "date: 2019-10-1" content/en/blog/*.md >en.list grep -e "date: 2019-10-1" content/fr/blog/*.md >fr.list # complete for other folders
This work it give files and content like: $ cat de.list content/de/blog/die-grünen-heuchler.md:date: 2019-10-16 content/de/blog/die-killer.md:date: 2019-10-17
# now check CURLINE=1 while [[ $CURLINE -le $LINES ]]; do CURDATE=`sed -n ${CURLINE}p orig.list # get an article date for FILE in en.list fr.list ru.list and_so_on; do COUNT=`grep -c -e "${CURDATE}" ${FILE} if [[ $COUNT -eq 0 ]]; then # not found in translation echo ${CURDATE} missing in ${FILE}" >missing.files; fi; done let CURLINE=CURLINE+1; # go to next original date done rm *.list # remove your temporary files
But this will not work. There is no output at end with a bit playing it run endless or there come Syntax Errors. But an Idea is born. -- Nice Day & Thank you Silvio