How To Convert a Text File To RTF, HTML, DOC And More Using Command Line

Well, here’s something for our Mac OS X users! Yes, actually textutil is a command line tool, which allows you to quickly convert text files to many other useful formats. Don’t worry, it’s very easy to use. Well, keeping the suspense a bit more, here’s presenting you the step by step guidelines with command entries below on how to convert the text file into RTF, HTML, DOC or more. Just check it out!

Mac OS X Terminal

First of all, open the Mac OS X Terminal, an type in the following command;

textutil -convert filetype filename

Well, conversion options are txt, rtf, rtfd, html, doc, docx, odt, wordml and webarchive. Here’s presenting you a sample syntax converting a text file named test.txt to an rtf:

textutil -convert rtf test.txt

Then, automatically textutil will automatically append the filename with the appropriate extension. However, if you want to give the file a new name in the conversion process, use the -output flag as follows:

textutil -convert rtf test.txt -output NewFileName.rtf

Also, if you have multiple text documents that you want to join together into a single new file, use textutil’s built-in cat function:

textutil -cat rtf file1.txt file2.txt file3.txt -output combinedFiles.rtf

Also, you can quickly verify the conversion was successful by opening the newly created rtf file in TextEdit with:

open test.rtf

That’s it!

Well, if you’ll have any difficulty while executing the above commands, then, don’t hesitate, just write to us in our comment section below. Also, if you are successful in performing the above, then, just don’t forget to share your views and comments on this with us.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Updates from our
Twitter Fans
Follow us @AppleSheet

© Copyright Apple Sheet 2009. All rights reserved. Jailbreak iPhone