由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - How to convert zipped text files to a ePub
相关主题
请教MS的高手一个shell的问题php DOM parse 中文乱码问题 (转载)
how to decode these data from users' input at a web siteNewbie javascript question: change radio button updates textbox message
how to convert GMT to timestamp of the computer's current timeMySQL 存储 中文出现乱码,用的 hibernate
sucks (转载)吐槽 MySQL
怎样遍历一个字母的组合 (转载)remove a module from cvs
同主题转寄 (转载)简单的perl问题
cookie的问题问一个link的问题
Marshal C++ struct to C# structLinux shell: xterm -e "commands" problem
相关话题的讨论汇总
话题: html话题: epub话题: convert话题: echo话题: zipped
1 (共1页)
D****r
发帖数: 309
1
Cablire only convert 1 page, don't know why.
thanks in advacne!
t******n
发帖数: 138
2
试一试calibre。
epub是html文件的zip打包?

【在 D****r 的大作中提到】
: Cablire only convert 1 page, don't know why.
: thanks in advacne!

D****r
发帖数: 309
3
thanks.
I am already using calibre and the zipped package is all .txt files.
D****r
发帖数: 309
4
seems the problem lies in charset/ encoding.
D****r
发帖数: 309
5
我参考网上捣鼓了个小程序,请各位大侠指正:
我用的cygwin + iconv, ebook-convert.exe
先把zipped text file unzip to a directory.
------------
#!/bin/bash
# convert all txt files in current DIR into one ePub ---- by Donier
### Firstly convert all files into utf-8 charset ###
for f in *.txt
do
if test -f $f
then
echo -e "\nConverting $f"
CHARSET="$( file -bi "$f"|awk -F "=" '{print $2}')"
if [ "$CHARSET" != utf-8 ]
then
mv $f $f.old
iconv -f "$CHARSET" -t utf-8 $f.old > $f
# rm -f $f.old
fi
fi
done
### pack all text file into one html ####
html=output.html
echo "" > $html
echo "" >> $html
for file in *.txt ; do
echo "processing " $file " ... "
h1=$(echo $file | sed 's/\.txt$//i')
echo "

Part" $h1 "


" >> $html
while read line ; do
echo "$line
" >> $html
done < $file
done
echo "" >> $html
echo "" >> $html
### convert html into epub
ebook-convert.exe output.html output.epub
1 (共1页)
相关主题
Linux shell: xterm -e "commands" problem怎样遍历一个字母的组合 (转载)
[合集] 问个PHP+apache的问题 (转载)同主题转寄 (转载)
Linux GNU C, readlink问题cookie的问题
Makefile的问题Marshal C++ struct to C# struct
请教MS的高手一个shell的问题php DOM parse 中文乱码问题 (转载)
how to decode these data from users' input at a web siteNewbie javascript question: change radio button updates textbox message
how to convert GMT to timestamp of the computer's current timeMySQL 存储 中文出现乱码,用的 hibernate
sucks (转载)吐槽 MySQL
相关话题的讨论汇总
话题: html话题: epub话题: convert话题: echo话题: zipped