add renaming script
This commit is contained in:
11
rename_posts.sh
Executable file
11
rename_posts.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
POSTS_DIR="content/posts"
|
||||
|
||||
cd $POSTS_DIR
|
||||
for post in *
|
||||
do
|
||||
title=`sed -n 's/^title: "\?\(.*\)"\?$/\1/p' $post`
|
||||
safename=`echo $title | iconv -t ascii//TRANSLIT | tr '[:upper:]' '[:lower:]' | tr -s '[:punct:] ' '-' | sed 's/-*$//g;s/^-*//g'`
|
||||
mv $post $safename.md
|
||||
done
|
||||
Reference in New Issue
Block a user