Search for a word in multiple ODT files
Hi,
I'm trying to find specific words within multiple documents. All the answers so far result in nothing. Does anyone know a way I can search the contents of a folder containing multiple odt files for a specific word please? I'm using LMDE and Libre office 1:4.3.3-2+deb8u3 Thanks |
Quote:
http://ubuntuforums.org/showthread.p...06#post5859706 http://www.linuxquestions.org/questi...es-4175511386/ http://superuser.com/questions/68220...ep-not-working DuckDuckGo is your friend... Best regards, HMW |
The first link I've tried and none of the results listed return anything. I search for the word "the" which occurs multiple times in multiple documents and it displays nothing.
The second link states "ODT files are ZIP files containing a structure of files and directories. You can unzip them. The text is in xml format in content.xml." but I've got no idea how I would unzip multiple files and then search them all for a word. It seems unlikely that it's possible in my extremely limited knowledge. A single file I could achieve but multiple files seems unlikely. The third results in: caution: filename not matched: /home/user/path/to/documents/doc1.odt caution: filename not matched: /home/user/path/to/documents/doc2.odt caution: filename not matched: /home/user/path/to/documents/doc3.odt /usr/bin/zipgrep: 97: test: -eq: unexpected operator /usr/bin/zipgrep: 100: test: Illegal number: Thanks for trying though. You say you know how it can be done, could you tell me directly please? :) |
People who come across this thread in future.
I found Code:
for file in *.odt; do unzip -c "$file" | grep -iq insertsearchtexthere && echo "$file"; done That was found here: https://superuser.com/questions/6822...ep-not-working |
Code:
zgrep -i -l insertsearchtexthere *.odt [edit] Ah ok, zgrep is for gziped files... |
Quote:
Best regards, HMW |
Quote:
I tried this solution myself and it works as one could expect. I have an .odt file with this content: ”Document containing keyword foo End!“ This is located here on my machine Code:
/home/HMW/Dokument/test.odt Code:
find $HOME/Dokument -name "*.odt" | while read file Code:
./searchodt.sh Best regards, HMW |
All times are GMT -5. The time now is 07:28 PM. |