CHM to plain text macOS : )

I recently discovered several of the books I want to reformat are in CHM format (Compiled HTML). While doing some research online I found the following blog post which gave me the general idea and guidance on how to go about converting my CHM books to plain text:

http://www.jaredlog.com/?p=1146

Since some of the steps didn’t quite work on my MacBook Pro with macOS Sierra, I had to use different tools to accomplish the same result. These are the steps I followed to get my CHM in plain text:

1) brew install chmlib
2) extract_chmLib file.chm folder
3) cd folder
4) ls | sort -n > list
5) clean up/sanitize the list file so it only includes the files you want to convert.
6) for i in `cat list`; do textutil -stdout -convert txt $i >> out.txt ; done

Needless to say I did all the above steps from the command line.

Hope this helps someone else looking for an answer : )

约瑟。

Advertisements
This entry was posted in Uncategorized and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s