[arch-general] grep

Aaron Laws dartme18 at gmail.com
Mon Oct 14 20:16:43 UTC 2019

On Mon, Oct 14, 2019 at 3:48 PM siefke_listen at web.de <siefke_listen at web.de>

> Hello,
> I have a question about grep, okay yes is not direct Arch but I not find
> a information and here on list sure some profis with grep.
> The folder structure:
> content/de/blog/*.md
> content/fr/blog/*.md
> content/en/blog/*.md
> content/ru/blog/*.md
> To know which articles I have translate I grep through dates:
> grep -e "2019-10-1" content/blog/de (for the dates between 10 and 19)
> I become:
> grep -e "2019-10-1" content/de/blog/*
> content/de/blog/file1.md:date: 2019-10-10
> content/de/blog/file2.md:date: 2019-10-12
> content/de/blog/file3.md:date: 2019-10-14
> content/de/blog/file4.md:date: 2019-10-16
> Now is my question,
> How can I do the same in the other folders and all those that
> exist with the same date are hidden and when no file is present give out
> the file which is missing in other folders sort by date. The name of
> file is sure other, but the date is ever the same.
> grep -e "2019-10-1" content/en/blog/*
> No output > all files translated
> grep -e "2019-10-1" content/fr/blog/*
> content/de/blog/file4.md:date: 2019-10-16 > file is missed
> grep -e "2019-10-1" content/ru/blog/*
> content/de/blog/file3.md:date: 2019-10-14 > file is missed
> content/de/blog/file4.md:date: 2019-10-16 > file is missed
> Grep to the first folder (de) as a comparison to the others (en,fr,ru).
> I had try it with diff but it want not work.
> Would be great there is a idea.
> Thank you for help.
> Silvio

I'm having a very difficult time deciding what you are asking, but perhaps
this is helpful. It sounds like you want to make sure each language has the
same files in it? For instance, given the existence of the files:
You want some sort of warning to be issued if only the following files
exist in another directory:
Is that correct? If so, you'll do something like

for file in content/en/blog/*.md; do
  basefile=$(basename "$file" .md)
  if [[ ! -e content/de/blog/"$basefile" ]]; then
    echo "German is missing $basefile";


Maybe instead you're saying that the dates present in one language should
also be present in another language? That would be a pretty different
solution with which I'm happy to help if you indicate such a desire.

More information about the arch-general mailing list