help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: append tag to thousand of files


From: Chris Elvidge
Subject: Re: append tag to thousand of files
Date: Sat, 2 Jan 2021 16:48:48 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 Lightning/5.4

On 02/01/2021 08:14 am, Silvio Siefke wrote:
Hello

first of all, I wish everyone a happy and healthy New Year.

I have a question, maybe someone has an idea for a way without
I have to click through thousands of files.

I have several multilingual websites written in Markdown. I would
now like to add a geotag to the website. For the German website,
this is largely done.

Header of MD File:
---
title: ""
date:
tags: ""
draft: true
shorttext: ""
cover: "cover/.jpg"
lang:
---

The filenames have in all languages the same name, with grep the
geo tag could be read out and write to file like:

***
grep -r "geo:" | sed 's/:/ /g' | sed 's/  /: /g'
how-people-become-resources.md geo: "Welt"
la-vie-product-recommendations.md geo: "Europa"
the-challenge-of-peace.md geo: "Welt"
corporations-lie.md geo: "Welt"
the-green-hypocrites.md geo: "Europa"
lets-celebrate-free-enterprise.md geo: "Europa"
how-to-annoy-people.md geo: "Asien"
the-values-of-hypocrisy.md geo: "Asien"
the-drug-terror.md geo: "Welt"
***

This is from german page and now the question is there a way to
search in other language folders the filename and put the geo tag to
header after tags: "" line?

---
title: ""
date:
tags: ""
geo: ""
draft: true
shorttext: ""
cover: "cover/.jpg"
lang:
---

Would be really great. Thank you for the voices. Lovely Weekend.


Not really a bash problem. Sed and the a(ppend) tag would seem to fit the bill.

sed -e /tags:/a\
geo: "Europa"

or something similar?

--
Chris Elvidge
England




reply via email to

[Prev in Thread] Current Thread [Next in Thread]