Convert Textile files to Markdown with a shell script
2019-01-18
Alan Vardy
Oh no! You have a ton of textile files which look like they are going the way of Betamax, and you wish that they were Markdown instead! Shell scripting to the rescue!
Install pandoc
sudo apt install pandoc
Navigate to your directory where the files are in the terminal of your choice and create your script file.
‘’’bash cd your/file/directory touch converter.sh chmod +x converter.sh gedit converter.sh ‘’’
Get a list of your filenames
find -name "*.textile"
And make your shell script using this as a template:
#!/bin/bash
#converter.sh
filenames=(file1 file2 file3 file4)
for i in ${filenames[@]}; do
pandoc ${i}.textile -o ${i}.markdown
done
Save and run your converter
./converter.sh
Move your old textile files (I’m going to call them posts) into an old_posts directory
mkdir old_posts
mv *.textile old_posts
And you are done!
Like what you see?
Related Posts
2018-12-09
2019-05-11
2019-05-11
2019-06-01
2019-06-01