libreoffice - writer - search options

marbles

New Member
Joined
Jan 2, 2023
Messages
22
Reaction score
3
Credits
217
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: 31


Condobloke

Well-Known Member
Joined
Apr 30, 2017
Messages
5,867
Reaction score
4,876
Credits
36,653
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
 

Condobloke

Well-Known Member
Joined
Apr 30, 2017
Messages
5,867
Reaction score
4,876
Credits
36,653
Just noticed, I am running libre 7.3.7.2....hope there is no difference!
 
OP
M

marbles

New Member
Joined
Jan 2, 2023
Messages
22
Reaction score
3
Credits
217
that doesn't help. please remember i am trying to find the number of occurences
 

wizardfromoz

Administrator
Staff member
Gold Supporter
Joined
Apr 30, 2017
Messages
8,346
Reaction score
7,249
Credits
33,110
Your search field does not have a word in it.

Type in the word and press enter.

Wizard
 

wizardfromoz

Administrator
Staff member
Gold Supporter
Joined
Apr 30, 2017
Messages
8,346
Reaction score
7,249
Credits
33,110
And I should have said, you still have to click Find All, which will then show the number of occurrences.
 
OP
M

marbles

New Member
Joined
Jan 2, 2023
Messages
22
Reaction score
3
Credits
217
for the screenshot i removed the word. but i assure you tried it in there ;)
 

Condobloke

Well-Known Member
Joined
Apr 30, 2017
Messages
5,867
Reaction score
4,876
Credits
36,653

wizardfromoz

Administrator
Staff member
Gold Supporter
Joined
Apr 30, 2017
Messages
8,346
Reaction score
7,249
Credits
33,110
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
 

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
8,530
Reaction score
7,296
Credits
69,382
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.
 

wizardfromoz

Administrator
Staff member
Gold Supporter
Joined
Apr 30, 2017
Messages
8,346
Reaction score
7,249
Credits
33,110
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
 

osprey

Well-Known Member
Joined
Apr 15, 2022
Messages
539
Reaction score
449
Credits
4,978
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:

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
8,530
Reaction score
7,296
Credits
69,382
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]
 

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
8,530
Reaction score
7,296
Credits
69,382
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!
 

osprey

Well-Known Member
Joined
Apr 15, 2022
Messages
539
Reaction score
449
Credits
4,978
KGill wrote:
Code:
Nah, it counts 'em just fine.
Yes. I was blind to the -o.
 

osprey

Well-Known Member
Joined
Apr 15, 2022
Messages
539
Reaction score
449
Credits
4,978
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:
[[email protected] ~]$ 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

[[email protected] ~]$ grep able dec2bin
grep: dec2bin: binary file matches

[[email protected] ~/bin]$ grep --binary-file=binary  able dec2bin
grep: dec2bin: binary file matches

[[email protected] ~]$ strings dec2bin | grep able
_ITM_deregisterTMCloneTable
_ITM_registerTMCloneTable
_ITM_deregisterTMCloneTable
_ITM_registerTMCloneTable

[[email protected] ~]$ strings dec2bin | grep able | wc -l
4
 
Last edited:

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
8,530
Reaction score
7,296
Credits
69,382
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.
 

osprey

Well-Known Member
Joined
Apr 15, 2022
Messages
539
Reaction score
449
Credits
4,978
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:
[[email protected] ~]$ grep --binary-file=text  able dec2bin
/lib64/ld-linux-x86-64.so.2GNU GNU
                                  T�-a�SDsE"��Œ�*t�[email protected] '.\ 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_DYNAM[email protected]@[email protected]@[email protected]@[email protected]@GLIBC_2.2.5__data_start__gmon_start____dso_handle_IO_stdin_used__li[email protected]8#[email protected] [email protected]$D���o�@NMC_END___ITM_registerTMCloneTable_init
                    �@�V�@��^���[email protected]���[email protected]�@��[email protected]�
�`��`��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:
[[email protected] ~]$ grep -o --binary-file=text  able dec2bin | wc -l
4
 
Last edited:

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
8,530
Reaction score
7,296
Credits
69,382
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.
 
OP
M

marbles

New Member
Joined
Jan 2, 2023
Messages
22
Reaction score
3
Credits
217
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! ;)
 
MALIBAL Linux Laptops

Linux Laptops Custom Built for You
MALIBAL is an innovative computer manufacturer that produces high-performance, custom laptops for Linux.

For more info, visit: https://www.malibal.com

Members online


Top