first scripts
This commit is contained in:
parent
178586c47a
commit
3bd579da3c
269 changed files with 96 additions and 3285 deletions
|
@ -13,10 +13,18 @@ find ../content -type f -name "*.md" | while read file; do
|
|||
if grep -q '^updated\s*=' "$file"; then
|
||||
echo "✘ Skipped: 'updated' field already present in $file"
|
||||
else
|
||||
# Insert updated field directly after the date line without quotes
|
||||
sed -i "" "/^date\s*=.*/a\\
|
||||
updated = ${current_date}
|
||||
" "$file"
|
||||
# Use awk to insert the 'updated' field after the 'date' field
|
||||
awk -v date="$current_date" '
|
||||
BEGIN { inserted=0 }
|
||||
/^date\s*=/ && inserted == 0 {
|
||||
print $0
|
||||
print "updated = " date
|
||||
inserted = 1
|
||||
next
|
||||
}
|
||||
{ print }
|
||||
' "$file" > "$file.tmp" && mv "$file.tmp" "$file"
|
||||
|
||||
echo "✔ Inserted 'updated' after date in $file"
|
||||
fi
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue