MAC Osx: Convertire txt file in .doc, pdf e viceversa via command line

The command line tool textutil allows you to quickly convert text files to many other useful formats. The command syntax you’ll want to use is:

textutil -convert filetype filename

Conversion options are txt, rtf, rtfd, html, doc, docx, odt, wordml, and webarchive, here’s sample syntax converting a text file named test.txt to an rtf:

textutil -convert rtf test.txt

Textutil will automatically append the filename with the appropriate extension. 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

If there’s multiple text documents 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

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

open test.rtf

You can also go the other direction and convert from any of the aforementioned filetypes back to txt, just remember that plaintext does not support any styling so the document will be stripped of any unique fonts, font sizes, styling, or other aspects of a rich text file.

Via Osxdaily

Informazioni su Davide

age 42, buddhist philosphy.

Pubblicato il 06/07/2011, in Guide con tag , , . Aggiungi il permalink ai segnalibri. Lascia un commento.

Lascia un commento

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...

%d blogger cliccano Mi Piace per questo: