Created
July 18, 2018 21:00
-
-
Save seventhsense/a7558e32572dbbd6939c913b5456a0f2 to your computer and use it in GitHub Desktop.
日本語ファイル名のmdをローマ字でハイフン分かち書きに変換するスクリプト(破壊的)要nkf kakasi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
dir=`pwd` | |
list=`find ${dir} -type f` | |
for file in $list; do | |
filename=`basename $file` | |
ext=${filename##*.} | |
if [[ $ext == "md" ]]; then | |
echo $filename | |
basename=${filename%.*} | |
names=`echo $basename | nkf -e | kakasi -w | kakasi -Ja -Ha -Ka -Ea` | |
# echo $basename | nkf -e | kakasi -w | kakasi -Ja -Ha -Ka -Ea | |
new_basename=${names// /-} | |
mv $filename "${new_basename}.md" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment