grep exists, but doesn't find pattern

Asked by rdtindsm

Ubuntu 10 32 bit installed on compac/hp w/ athlon dual core processor.
system is about a week old and I have just begun setting it up and finding out what does and doesn't work.

grep does't work.
I created a small open office file containing:
     the quick brown fox jumps over the lazy brown dog
     now is the time for all good men to come to the aid of their country.

grep dog test.odt returns nothing including an error message
grep dog test.odt > foo.txt creates an empty file
grep dog foo returns missing file err ms.

Not a unix expert, but have sporadic experience using several editors, awk, and of course, grep.
No idea what could be wrong.

Question information

English Edit question
Ubuntu Edit question
No assignee Edit question
Solved by:
Robert Di Gioia
Last query:
Last reply:
Revision history for this message
Best Robert Di Gioia (digioiar) said :


The problem is that an odt file is not a text file, and the input text is not stored as normal text. You can see this by opening an odt file with a text editor (or using hd or strings), not OpenOffice.

Try entering your sample text using your favorite text editor (I like vim/gvim, but if you haven't used it before, it may not be too that case use gedit which works like Windows notepad). Then your test with grep will be successful.


Revision history for this message
rdtindsm (rdtinknx) said :

Thanks Robert Di Gioia, that solved my question.