libreoffice - writer - search options

marbles

Member
Joined
Jan 2, 2023
Messages
122
Reaction score
20
Credits
1,117
stupid question - i know

so i'm searching for a word in a libreoffice writer 6.4.7.2 document

at the bottom, didn't it use to show how many occurrences of that word are in the document?

i don't see it anymore

where it says "1 word" is wrong, i have many occurrences of this word
 

Attachments

  • writer.jpg
    writer.jpg
    34.3 KB · Views: 130


Enter the word...click enter.....then Click on 'find all'....and the click on the up or down arrow to reveal each instance of that word
 
Just noticed, I am running libre 7.3.7.2....hope there is no difference!
 
that doesn't help. please remember i am trying to find the number of occurences
 
Your search field does not have a word in it.

Type in the word and press enter.

Wizard
 
And I should have said, you still have to click Find All, which will then show the number of occurrences.
 
for the screenshot i removed the word. but i assure you tried it in there ;)
 
I performed a similar exercise on one of my documents, different version of LO, it worked fine.

LO although open source is not a linux product, you may have to ask at their forum.

What Linux are you using?

Wizard
 
Code:
grep -o -i word path/to/file.txt | wc -l

I'm not sure if that's gonna work in rich-text formats, but you can give it a shot.
 
Needs a forward slash before path, but comes up with 0 (zero) on an .odt doc I have with 38 instances of the word "light".

Nice tip, though, for text files.

Wiz
 
Code:
grep -o -i word path/to/file.txt | wc -l

I'm not sure if that's gonna work in rich-text formats, but you can give it a shot.
But what if there's multiple occurrences of the word on one line?
The strings command will read a binary file.
 
Last edited:
But what if there's multiple occurrences of the word on one line?

Nah, it counts 'em just fine.

Code:
nano test

Enter the following:

Code:
the cat is a happy cat
the dog is not a cat

Run the following:

Code:
grep -o -i cat ./test | wc -l

VEOyzHi.png
[/code]
 
Nice tip, though, for text files.

I *think* it may work for .docx and the likes - as grep can even parse bin files.

Lemme test that...

Yeah, for some reason it's hanging on .docx - but grep *should* be able to parse it as it can even parse binary files. Weird...

LOL Well, temporarily save the file as .txt and then run the command!
 
KGill wrote:
Code:
Nah, it counts 'em just fine.
Yes. I was blind to the -o.
 
KGill wrote:
Code:
grep *should* be able to parse it as it can even parse binary files.
It may depend on the binary type, for example on an ELF binary I get the output:
Code:
[flip@flop ~]$ file dec2bin
dec2bin: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=0b548f2d61e95344734522a5e0c592c52a74f031, not stripped

[flip@flop ~]$ grep able dec2bin
grep: dec2bin: binary file matches

[flip@flop ~/bin]$ grep --binary-file=binary  able dec2bin
grep: dec2bin: binary file matches

[flip@flop ~]$ strings dec2bin | grep able
_ITM_deregisterTMCloneTable
_ITM_registerTMCloneTable
_ITM_deregisterTMCloneTable
_ITM_registerTMCloneTable

[flip@flop ~]$ strings dec2bin | grep able | wc -l
4
 
Last edited:
It may depend on the binary type, for example on an ELF binary I get the output:

I can't get it to work on .docx or .odt.

So, again, just save it as a .txt file and run the command. It's crude, but I suppose it'll do the trick.
 
KGill wrote:
I can't get it to work on .docx or .odt.
Same finding here, can't get any result from grep on a .docx file, nor from strings.

Interestingly, on the ELF file, there is another possibility in addition to the commands on post #16 where the grep command is invoked to read a binary file as text:
Code:
[flip@flop ~]$ grep --binary-file=text  able dec2bin
/lib64/ld-linux-x86-64.so.2GNU GNU
                                  T�-a�SDsE"��Œ�*t�1@ '.\ k
                                                             libc.so.6__isoc99_scanfputsputcharprintf__libc_start_main_ITM_deregisterTMCloneTable__gmon_start___Jv_RegisterClasses_ITM_reg�uierTMC��`�`�`�`GLIBC_2` `(`0`8`@H�H�M
�@e�@���H`� �@�@�
(@c) =WP`c }
            �@crtstuff.c__JCR_LIST__deregister_tm_clonesregister_tm_clones__do_global_dtors_auxcompleted.6934__do_global_dtors_aux_fini_array_entryframe_dummy__frame_dummy_init_array_entrybina.c__FRAME_END____JCR_END____init_array_end_DYNAMIC__init_array_start_GLOBAL_OFFSET_TABLE___libc_csu_finiputchar@@GLIBC_2.2.5_ITM_deregisterTMCloneTabledata_startputs@@GLIBC_2.2.5_edatato_binary_finiprintf@@GLIBC_2.2.5__libc_start_main@@GLIBC_2.2.5__data_start__gmon_start____dso_handle_IO_stdin_used__libc_csu_init_end_start__bss_startmain_Jv_RegisterClasses__isoc99@8#T@T 1t@t$D���o�@NMC_END___ITM_registerTMCloneTable_init
                    �@�V�@��^���oX@Xk���op@pz�@��B@�
�`��`��H`HL`L�0L,�x-    ��                         ��@���@�p� @ "�@D    �@�@<���
The output highlights the term "able" in color on my screen, and when invoked with -o and piped to wc gets the right result:
Code:
[flip@flop ~]$ grep -o --binary-file=text  able dec2bin | wc -l
4
 
Last edited:
While researching the .docx and .odt issues, I did see it's also possible (albeit with a different tool) to do the same thing with a .pdf document.

I have no idea why it's not working with those two file types. I can't even get it to work on .rtf files.

So as to not confuse the OP, we're just discussing some intricacies regarding grep. You legit can save the file to .txt and use the above command, assuming there's no other solution.
 
wow. thanks for everyones effort (i assure you i don't deserve it)

oz -
i don't think this depends on the version of linux i'm using, it should depend on the version of libreoffice (please correct me if i'm wrong)

condo -
obviously my first question is - how many bathrooms do u have in your condo ;)
obviously my 2nd question is - which version of libreoffice are using

is there a way to tell whats the newest version of libreoffice one may use with their distribution of linux

in conclusion,
this sucks! ;)
 

Members online


Top