A lot of you might have different methods to convert a text document into another format. The simplest method for some of you will be to open the text document in a simple editor such as TextEdit, and then export it as another format. Another method could be to open the file in Microsoft Word and save it as a Rich Text or Plain Text document.
One method that you might not know about is using a command in Terminal to convert files from one format to another. While this method might not suit all of you, it’s a good use of OS X’s command line.
The command that can be used for this is the
textutil command, which can be used to convert a document to a specified format.
1. Open Terminal on your Mac either by Spotlight or by navigating to “Applications -> Utilities”.
2. Type in the following command into Terminal (don’t press Enter yet):
textutil -convert FILEFORMAT
Here, replace FILEFORMAT with any of the following formats into which you want to convert your file into:
3. Press the space bar on your Mac and ensure there’s a space after the file format, and then drag the document you want to convert into the Terminal window:
Once done, the total command will look something like this, depending on the file name and file location:
Once you execute this command, the new (converted) file will appear in the same folder as the original.
Batch convert text files to other formats
A good use of this command is to batch convert text documents into another format. To do this, instead of dragging a specific file, drag a complete folder to the Terminal window. Then, after the folder path, simply add a forward slash to the end of the folder path (ensure that there is no space between the path and the forward slash) ‘/’, followed by “*.FORMAT”. Replace FORMAT with the original file format, which you’re converting.
For example, in the command below, all .docx files in the folder “Docs” will be converted to .txt files:
textutil -convert txt /Users/shujaaimran/Desktop/Docs/*.docx
The resulting converted files will be located in the same location as the original.
And for those of you who prefer not to use such commands, a quick way to strip text of all formatting is to paste it into Terminal, and then copy it back to the desired format you want to paste it in.
Using Terminal to quickly batch convert documents is a simple and cost-effective measure, which you can take advantage of without downloading any other third-party applications. While some of you will prefer to use simple text editors such as TextEdit for this, many of you will like this use of Terminal and take full advantage of it. Just remember, don’t mess up the commands, as messing around in Terminal has proved to be disastrous for many in the past.
Be sure to let us know in the comments below which text editor you prefer to convert documents from one format to another. Also, let us know whether the above methods worked for you or not.
Our latest tutorials delivered straight to your inbox