13.07.2015 Views

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 9 ■ WORKING WITH TEXT IN FILES■ Note If you find digraphs annoying (if you regularly have to backspace to correct single characters, you mayend up inserting them by accident), type :unset digraphs in command mode (or add unset digraphs to your~/.vimrc file), and use the following:Ctrl-K char1 char2instead of the following to enter digraphs:char1 backspace char2This method is always available, even when digraphs aren’t set.9-6. Getting Readable Text from BinariesSometimes it can be necessary to see whether you can extract useful string (text) data from binary files. Agood sign that you have a binary file is when you try to cat it and you get a warning that it may be abinary file, although not all systems give you this warning. (Debian lenny doesn’t, but current Ubuntudoes.) If you go ahead with the cat, you’ll get a screenful of gibberish.■ Note If your terminal does get scrambled, type one of these, even if you can’t see what you’re typing:setterm –resetecho [Ctrl-V] [Ctrl-O]This sort of terminal scrambling does seem to be less common than it used to be. You can also use cat -v to getbetter output from binary files.One case may be if you want to get text information out of a proprietary file format. In some cases,your best bet may be to open it in open source software that reads the file format (such asOpenOffice.org for Word documents). However, this can be slow if all you need is text data.For Word documents, the utility antiword (Debian/Ubuntu package antiword, installed with sudoapt-get install antiword) is good:antiword file.doc | less200Download at WoweBook.Com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!