View Single Post
  #7 (permalink)  
Old 18-Aug-2007, 19:27
AndrewTheArt
Guest
 
Posts: n/a
Default

I was personally trying to avoid any dependencies beyond the basics, but I guess it's a necessity to reformat the XML.

So, with Ken's help, I've designed a relatively crude ODT search...

Code:
#!/bin/bash

mv $1.odt $1.zip
unzip -qq $1.zip -d $1
cd $1
echo "Instances of $2"
tidy -q -xml < content.xml | grep "$2"
cd ..
rm -r $1
mv $1.zip $1.odt
Command line usage is

Code:
sh SearchODT.sh ODTFileName "Search term goes here"
(Assuming you name your batch script SearchODT)
(Do not put the .odt at the end of the filename...)

It has some minor formatting issues, but it basically get the job done. Further refinement could come later.