MoatazAbdAlmageed/codingdir

make file name equal to title property in md files

Opened this issue · 1 comments

to make edit links works in single post

bash script


#!/bin/bash
prefix="title:"

for filename in *.md; do
        # name=cat $filename| grep -w title
        # echo $name

# foo="`cat $filename`"
# echo "${foo[@]}"
newFileName=`sed -n '2p' < $filename | sed  -e 's/ //g' -e "s/^$prefix//"` 
echo $filename
echo $newFileName
mv $filename  $newFileName
#  echo "$filename" | sed -e "s/^$prefix//"

done