This is how far I've gotten:
ls $1 | while read x; do echo "pandoc '$x' -o $x" | sed 's/\.[^.]*$//' | sed 's/$/.txt/' | sed 's/$/ --wrap=preserve/' ; done
What this does is it prints out the command that you'd have to run for every file to convert a file to TXT using pandoc.
The problem is if you replace echo
with eval
it doesn't work. I hypothesize because you are modifying the command after you run it ... somehow? Yet still it's printing properly?
The result I got when I ran it with eval
was just it copying EPUB files as opposed to converting them which explains my hypothesis.
So my question is, how can I run every command as it's actually printed like so:
pandoc 'Complicity - Iain Banks.epub' -o Complicity - Iain Banks.txt --wrap=preserve
Something like this should do that:
for f in *; do
pandoc "$f" -o "${f%.*}.txt" --wrap=preserve
done
What do you need ls
/eval
for?