How to search for content in LibreOffice.org (+ OpenOffice.org) Docs using Loook

Today's post is a response to Tony Bradley's post on pcworld.com entitled: "Ubuntu Linux, Day 19: Using 'man' and 'grep'". In his post, Tony describes his woes when trying to use 'grep' to search for content in LibreOffice documents.

First of all, in my experience, grep does a lot better job at finding things in files that are "plain text" rather than looking for stuff in "binary" files. LibreOffice documents, while saved in open and ISO standard formats, are stored in binary as opposed to plain text files.

So, to address Tony's problem, I've been looking around trying to find a way to search for content in ODF files and not having much luck. Surprisingly, there doesn't seem to be this type of functionality built into Ubuntu GNU/Linux by default (at least not that I have ever noticed).

However, there's a posting out there on ooofourm.org that mentions the problem, how additional development is needed for this specific feature to be added, and some suggestions for what to use until the functionality is built into Ubuntu GNU/Linux. The recommended tool that I've had success with is named "Loook", by Daniel Naber at danielnaber.de/loook.

Loook is a lightweight, python-gui-based, FOSS program that enables you to search for content in your LibreOffice (and/or OpenOffice) files, and it works great!

Using Loook in Ubuntu 11.04 takes just a bit of setup. Here's my writeup on how to do it:

1.) Ubuntu GNU/Linux 11.04 has Python 2.7.1+, and so you need the version of Loook for Python 2.x(not 3.1), which is currently 0.6.5.
So download Loook the version of Loook for Python 2.x from:
http://www.danielnaber.de/loook/

2.) Extract the loook.zip file.

3.) Loook needs python-tk to run, which is not installed on Ubuntu 11.04 by default. But don't worry, installing this package is easy. Just enable the 'universe' repositories from the Ubuntu Software Center, then either install "python-tk" from the gui or install it by using the Terminal command:
sudo apt-get install python-tk

4.) To run: Double click the loook.py file that was extracted in step 2 above, then select "Run". You'll be presented with a dialog where you can enter "Search Terms", the "Search path", and the "Viewer" (insert /usr/bin/libreoffice here). Click search and Loook will find the documents containing the text you inserted. You can then double click on any result in the "Matches:" section and that will launch the document for you to peruse.

Power User Tip:
If you want to go a step further, you can create a "launcher" shortcut for the Loook.py program. Simply move the Loook.py file to somewhere where it can stay put (e.g., your Documents or home directory), then right click the Desktop, select "Create Launcher", leave "Type" as Application, enter the name "Loook", then enter the absolute path to the loook.py file (e.g., /home/dude/Documents/loook.py - in my case). With the Launcher, you can also add it to your panel or Unity bar with drag and drop. Note: you may want to set a better looking icon for your launcher before adding it to your panel. This can be done by opening your newly created Loook launcher *.desktop file in gedit (e.g., alt+f2 for Run, then type or paste "gedit ~/Desktop/Loook.desktop", no quotes), then change the name of the icon to use to something like "eog" (it's an icon for the "eye of gnome" program - looks like a search icon). Save the change and you should see the nice eog icon for the launcher.

Example Loook.desktop contents:
#!/usr/bin/env xdg-open

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[en_US]=eog
Name[en_US]=Loook
Exec=/home/dude/Documents/loook.py
Name=Loook
Icon=eog


So, while the functionality to search for content in LibreOffice/OpenOffice documents does not appear to be built into Ubuntu by default, it is a very easy thing to do with awesome Free Open Source Software programmers like Daniel Naber and his great project Loook.

Feel free to leave a comment if you have one.

Cheers!

Shannon VanWagner

Comments

  1. Well, your instructions were clear, thx for that and I was able to get Loook for Python 2.x running. But it doesn't seem to recognize files as Open Office? Even in a folder full of them it 'says': 0 matches in 0 files.

    ReplyDelete

Post a Comment

Thanks for commenting. Comments are moderated by the blog owner and will appear once approved. Need to email me directly? Go to http://shannonvanwagner.com/email-me.php

Popular posts from this blog

On Helping Others Get their GNU/Linux & Consider Doing So

How To: Install Wordpress on Manjaro Linux Pahvo 21.1.0

How to Disable Middle Mouse Button in Ubuntu / Debian Linux