博客文件整理——分类/标签
批量修改分类名
1 | ls *.md | xargs sed -i '/categories: |
文件指定行数的字符大写转小写
所有tag改为小写
1 | find -name "*.md" | xargs sed -i '4,9s/.*/\L&/' |
删除所有文件行尾空格
1 | find source/_posts/ -name "*.md" | xargs sed -i 's/[ ]*$//g' |
标签一行变两行
1 | categories: |
1 | grep "categories: " _posts/ -rn | awk -F: '{print $1}' | xargs sed -i "s/categories:/categories:\\n -/g" |
统计当前所有的标签
1 | grep "tags" ../_posts/ -rn -A 6 | grep " - " | awk '{print $3}' | sort -u |