在Calibre 中開啟文字檔案。
將文字檔案內容 import 後轉成 epub格式檔案。
Edit book in Calibre.
1. 在 Edit book 中啟動 "Marked text" option。
2. 使用 mouse,配合 Ctrl+Shift+M 將欲處理的文字標示起來。
3. 使用 Calibre 中的 regular expression (Regex) option,作 search & replace。
Regular expression routine
Find: (.*)([^。|^!|^”|^:]{1})\n\n
Replace: \1\2
說明
若某一文字片段在
之前不為「。」或不為「!」,或不為「”」或不為「:」則去掉後面的\n等字元。\n: 換行的識別字元 (i.e., newline)
Click on "Find" box.
Click on "Replace all" box. All the patterns in the marked text which match the regular expression described above will be processed.
Repeat the above procedure several cycles, until the search routine does not find more contents to be replaced.
7/21/2015
3/10/2015
Using Regex search & replacement in Sigil
To make "Chapter XY" text(s) with ordinary format to that with level-3 heading in Sigil, do the following Regex find-and-replace:
Find: Chapter (\d+)
Replace: Chapter \1
\d tells Sigil to find a digit.
\d+ tells Sigil to find one or more digits.
() groups the words together for later retrieval.
\1 is used in Replace to retrieve the value of a saved group. (Use \2 for the second group, etc.)
Find: Chapter (\d+)
Replace: Chapter \1
\d tells Sigil to find a digit.
\d+ tells Sigil to find one or more digits.
() groups the words together for later retrieval.
\1 is used in Replace to retrieve the value of a saved group. (Use \2 for the second group, etc.)
2/24/2015
讓 Calibre 認識中文的章節分段 (用於產生 ePub 電子書的TOC)
下列 XPath 表示式讓 Calibre 在 import .txt 或 .pdb 電子檔時,可以分析其結構而自動產生 TOC (Table of Contents)
//h:h2[re:test(., "第(零|一|二|三|四|五|六|七|八|九|十|百|[0-9])+(章)\s", "i")]
//h:h2[re:test(., "第(零|一|二|三|四|五|六|七|八|九|十|百|[0-9])+(章)\s", "i")]
1/23/2015
將簡體的電子書轉為繁體
- 利用 Calibre 將 .mobi, .azw, azw3 等格式的電子書檔案轉為 .epub 格式。通常中國的電子書在 Windows 電腦系統中的書名亦為 UTF-8 編碼的簡體字。
- Download 到 local 電腦之後, 此時應先利用 ConvertZ.exe 轉為 UTF-8 編碼的繁體漢字。
- 當文件的名稱都轉為繁體字碼之後,就可利用 epub Converter 1.5 (by Denny Su) 將文件的內容從簡體字轉換為繁體字了。
1/06/2014
To browse text file in western language(s) inside vi
In case the text file is in German,
after invoking vi,
put the follwing setting in command line:
:set encoding=latin1[enter]
after invoking vi,
put the follwing setting in command line:
:set encoding=latin1[enter]
10/25/2013
To walk through the lines of two files at once
To walk through two files at once...
The following sample Perl code read the corresponding lines of two files, and print the line which contains the joined string to another file.
if ($#ARGV != 1) {
print STDERR " Usage: perl $0 List_1 List_2\n";
exit(1);
}
open(FileIn1, "$ARGV[0]") || die "Could not find file list $ARGV[0]";
open(FileIn2, "$ARGV[1]") || die "Could not find file list $ARGV[2]";
$outFile = "ChangeName_gbk" . ".bat";
open(FileOut, ">$outFile");
while (!eof(FileIn1) and !eof(FileIn2)) {
my $line1 =;
my $line2 =;
chomp $line1;
chomp $line2;
print FileOut "rename \"$line1\" \"$line2\"\n";
}
close(FileOut);
close(FileIn1);
close(FileIn2);
The following sample Perl code read the corresponding lines of two files, and print the line which contains the joined string to another file.
if ($#ARGV != 1) {
print STDERR " Usage: perl $0 List_1 List_2\n";
exit(1);
}
open(FileIn1, "$ARGV[0]") || die "Could not find file list $ARGV[0]";
open(FileIn2, "$ARGV[1]") || die "Could not find file list $ARGV[2]";
$outFile = "ChangeName_gbk" . ".bat";
open(FileOut, ">$outFile");
while (!eof(FileIn1) and !eof(FileIn2)) {
my $line1 =
my $line2 =
chomp $line1;
chomp $line2;
print FileOut "rename \"$line1\" \"$line2\"\n";
}
close(FileOut);
close(FileIn1);
close(FileIn2);
7/28/2013
iexpress
Step-by-Step to wrap a vbs into an .exe
Here
is a way to use Iexpress 2.0 to wrap your VBS scripts into an .exe.
Iexpress 2.0 is native to Win XP and Win 7 and is quite useful when you
have a VBS that is dependent on other files, like and install program or
even an HTA. Once you have created the .EXE package a .SED file is also
create in the same directory, which is the instructions for the
Iexpress.exe. You can edit the .SED file in notepad and then run the
iexpress wizard and select Open Existing Self Extraction Directive file and
create your new package. This is helpful when you want to add new
files, change the command line, or the output directory, you do not need
to go through the whole package process again. Below are the
instructions on how to create a new .EXE using Iexpress 2.0.
1. On a computer running Windows XP or Windows 7, click Start, click Run, enter iexpress, and click OK. This starts the IExpress Wizard.
2. On the Welcome to IExpress 2.0 page, select Create new Self Extraction Directive file and click Next.
3. On the Package purpose page, select Extract files and run an installation command and click Next.
4. On the Package title page, type a title for your package and click Next.
5. On the Confirmation prompt page, select No prompt and click Next.
6. On the License agreement page, select Do not display a license and click Next.
7. On the Packaged files page, click Add and select the vbs script from the directory in which it resides:
8. When you finish adding files, click Next.
9. On the Install Program to Launch page, in the Install Program box, type c:\windows\system32\cscript.exe “yourVBS.VBS” OR c:\windows\system32\wscript.exe “yourVBS.VBS” Leave the Post Install Command box BLANK.
10. On the Show window page, select Hidden and click Next.
11. On the Finished message page, select No message and click Next.
12. On the Package Name and Options
page, enter the path and filename that you want for this distribution
package. Check both boxes and click Yes to the warning under Options and click Next.
13. On the Configure restart page, select No restart and click Next.
14. On the Save Self Extraction Directive page, select Save Self Extraction Directive (SED) file:, edit the path and name of the file, and click Next.
15. On the Create package page, click Next. When the package has been created, click Finish to exit.
16. The package will now be created with the name you specified and have an extension of .EXE ex. “yourVBS.EXE”
訂閱:
文章 (Atom)