Search file system for files by text content

Forum Forums New users New Users and General Questions Search file system for files by text content

  • This topic has 33 replies, 6 voices, and was last updated Jan 24-8:05 am by BobC.
Viewing 15 posts - 1 through 15 (of 34 total)
  • Author
    Posts
  • #97602
    Member
    andfree

      Hi. Is there any way to search the file system for text files that contain particular key words?

      #97604
      Member
      xinomilo
        Helpful
        Up
        0
        ::

        lots of ways to do it..

        mostly used to :
        $ grep -nir $text $dir
        or
        $ find $dir -name ‘*.txt’ -exec grep $text {} +

        find example above will only look for txt files, while grep will look any file..
        in anycase, customize it to your needs. replace $text + $dir with what/where you want to search.

        #97606
        Member
        Robin
          Helpful
          Up
          0
          ::

          Yes, just like xinomilo has already explained, on console exist lots of methods. And in antiX there is also present a GUI allowing this search.
          Open from antiX Main menu → Programs → Utilities select “zzzFM File search” (alternatively from zzzFM Menu bar → Menu “File” → “File search”).
          In tab “General” enter *.txt as file name to the “file name” field.
          In tab “Content” enter text to search for to the field “search for”.
          Start search by pressing the search button.

          In case of multiple keywords check the box “Use regular expression”
          Use appropriate search pattern in search field. Example:
          keyword1 \| keyword2 \| keyword3
          to find files which contain one of these three keywords.

          Windows is like a submarine. Open a window and serious problems will start.

          #97612
          Moderator
          BobC
            Helpful
            Up
            0
            ::

            Midnight Commander (mc) has a good Find files option on the command menu.

            Searchmonkey (not sure if installed by default) also has real nice file search ability.

            I wonder which has the best features? And which has the best performance?

            Typically, I use grep or mc, but as robin said, there are many possible programs and methods.

            #97667
            Member
            andfree
              Helpful
              Up
              0
              ::

              Thanks for your help.

              mostly used to :
              $ grep -nir $text $dir

              I’m not sure I understand it. Is this one command?

              select “zzzFM File search”

              I try a search in my “Documents” directory, but nothing is found.

              Searchmonkey (not sure if installed by default) also has real nice file search ability.

              I have installed it and I try the same search. It finds an odt file, but then it crashes:

              $ searchmonkey
              * XML Word document present in position:3 *
              * XML Word document present in position:3 *
              * XML Word document present in position:3 *
              * XML Word document present in position:3 *
              * XML Word document present in position:3 *
              * XML Word document present in position:6 *
              * XML Word document present in position:6 *
              * XML Word document present in position:6 *
              * XML Word document present in position:6 *
              * XML Word document present in position:6 *
              * XML Word document present in position:6 *
              * XML ODT document present in position:10 *
              * XML ODT document present in position:10 *
              * XML Word document present in position:8 *
              * XML Word document present in position:4 *
              Segmentation fault

              Midnight Commander (mc) has a good Find files option on the command menu.

              I only see a “Find…” command under the “Search” menu, but I don’t understand what exactly does.

              #97671
              Member
              xinomilo
                Helpful
                Up
                0
                ::

                I’m not sure I understand it. Is this one command?

                yes, for example to search for “antix” in all files in home folder :
                grep -nir antix ~/

                #97675
                Member
                andfree
                  Helpful
                  Up
                  0
                  ::

                  to search for “antix” in all files in home folder :
                  grep -nir antix ~/

                  Thanks, it works. But I see that it doesn’t find odt files. I created a new one, named “file”, put in the “Downloads” folder, and containing only the word “test”. Not found by the command:

                  grep -nir test ~/Downloads

                  zzzFM also doesn’t find it. Searchmonkey does.

                  #97681
                  Member
                  xinomilo
                    Helpful
                    Up
                    0
                    ::

                    odt is not a text document. try cat file.odt to see what grep sees/looks for.

                    #97683
                    Member
                    PPC
                      Helpful
                      Up
                      0
                      ::

                      Dear andfree – just to make the situation clear: usually Linux command line commands that search for text perform the search in text files. Files created using word processors (like Writer and Word) usually are not simple text file, and usually can’t be searched by this tools. There are ways to perform the search on other file types other than simple text, if you dig around the web for them. I’ll try to post some options here…

                      P.

                      #97777
                      Member
                      andfree
                        Helpful
                        Up
                        0
                        ::

                        Thanks for your replies.
                        I moved the file to the home folder, and then:
                        $ cat file.odt

                        I can’t add the output as an attachment.

                        $ cat file.odt
                        PïR3V^Æ2
                        ‘mimetypeapplication/vnd.oasis.opendocument.textPïR3VConfigurations2/accelerator/PïR3VConfigurations2/images/Bitmaps/PïR3VConfigurations2/progressbar/PïR3VConfigurations2/statusbar/PïR3VConfigurations2/toolbar/PïR3VConfigurations2/toolpanel/PïR3VConfigurations2/floater/PïR3VConfigurations2/popupmenu/PïR3VConfigurations2/menubarïR3V
                        manifest.rdf͓Ín0ï<eÎØ@/r(ʹjÀ5X/ò޾VQ¤ªêÔã®F3ߎ´íaȋ²¨ÁT4c)%ÊHhµé+:».¹¥Û:Úض+ñj¥*ºwn*9_-7
                        lϳ¢(xó<O¼”ÁÕ8qH
                        ^[[?1;2c^[[?1;2c^[[?1;2c Biõä|9Îâ fWQt렐y÷ =Ý:© ²
                        a¶R½¶ @ LʄtºNKÅ3óQ9Á¡íâǽӃ¢<ð+ÏØވ
                        ¦å^཰î\ß|hzîczuÓÅñß#2îOê»;yÿçþ.Ïÿ⯴vDl@Σgúç´òUG¯P´÷hïR3meta.xmlSM0¼÷W ºW06(¥zڪWý¸fIÿ}Íçf*.ö¼÷<cS<Û&xc¥Veã$
                        @q-¤ªËð×ák´ªO~}¨мoA¹¨Ç/UÖF¦
                        OÎu¡aâ!µ©IÕH0Ǣ7 ÃçpQâ2썢Yi©b-Xê8Õ¨u}çÒéXó^ðmTכf$8FE8ÆhåþÜ;ÎóMՕªµވã)f¿«
                        Ø Íû=íþ×ÝdbY_՚îèµ*&ÇÜsùô ” I£G8?`B ¡iïÒÞ’É>/ÐE!8½’MiÆi &»G/]ióTÒùDo¦^ՏþñÏeÄMù£ÿå
                        _±xænÈ:ßÂ:Ƀ wìØ@Äu¯\ú&P¶¬¾õñ7pwvL¼aՆu§ë ¸Æøɳ¹³²¥ |¤ÃI:°ã~Æ–ÞjPàѦzGߧKEqæ?òð,U~9ïwÁEõ¥3z´²äáK/%½÷fúð<н_±úPBïR3V
                        settings.xmlµ[ÝW;¿wZµ£öJK
                        ¬çö-ìk6ٓdþû;]¨P
                        ̰3É|þf&\~%êà ¬F_?@G&z|Uº4?¾\ÿsiF#A%6Qö¼ÇGܾ®]%2z$ñÌêNº ¸*&½x­òüéJ`_)©¯JïÓJ¹<N?L?~0v\>¾¸¸(»G1Ëv¾²ððÉÑÑi9ÿ½|:üzï]ߟæcéz!Åö¯/½äÒCB²9(.³«.¹ò$aºZiÝ{¾ó¯Zwü<Å;Êèqéú貼Jâýd[0òtdì’k îFüñdý²?~:ú´õþÄL{£A}”ôÜ
                        C]ºö6íx4u͚©¶aõPîÝäJÃ
                        âUa­7°ð»¿OäÍøÅR·M¶|²½*7ÚÞéÙÅÙöd7yÊÉÙÑñ¶T*ؿ¯²{÷ì@µ·ÑEÈ·ÖZ ]3ޛd£yc7¬ýhKÙ4]DâÅúâQKÌMæëFe~éÓõ­

                        Kÿ?ö7Ãï»TD¯ê
                        ñf¾é¤
                        ÷ÁiЀÅÁ@}úMá¦DŽå÷*%ÜťÂĨ^FÃ}¬õkæ=ت_MÉ{X pÙ}Þt»ìë@ñ~ܑ_È,iCÿ
                        à·Å췍HO}f]kÎ9вÂî}îîl³µ¹=Mgˠ&P ¿Ĭ»í¨ÃwMÜî0;àºÖ*{=×ø÷Çkº­õ¦é(Ý+í÷ӏ^ÂÐáÂÓZt¯7ã»meV=áé§ÞFƠS5ǰ[Mã75~¥²ûªûáSPOüj}r!Öàê~1¶í>gGèv8ß~9¦`ÿóÿ/4#fD(ÿVÒ.>7iÿøõ7GãüÛSô2´ÕRaÑý r|t
                        YÃ æ ‘ñgvu߹ÕÕ핸»p´§MզØló÷³áN?°ucflìáÈNáVÖÍ
                        ZEíü¿5ãv¯K5½rjtÚ}ÏSr|Á¤£VÞŤ{¡ôø¿ïÖ[Qjw!s9JÔaddOXÅîð2àw½ï+sdÞJ1ôò:¦§VSIBQ{Ðڪ&þF5oZðê߀
                        µå掿Ol¥m3ØًIÑæäº;lÉ8zmêÛ#Y¼Òdù±.ÈêÎÆlöB¤M?yx¤y`Åiïޡ ¿*îXtE
                        aâB{bÑm)í}ó¤& êôÑAXlÁ­°µ¡Íï>ÄæÕùÀ½ôî1+ͣK5è’ª©êÉ%ãæMÆÈó¼Ç[Hx:d í7Ћ74ô©<¹7r{뺺
                        £°¾©mÓ*ySѣ/ ;OUÖÛ7¯Ô3kÑPÉzh1¡ã5­6ÜØ֍¶»ßé Îà}ðTRÉtE£<ö
                        ôª°Âæ/ñBBôÙ7]i+½¿`­Òö© ø® <³ÔXi͗æ*dÂÆüin
                        bP,â_ͼɝ)4ÔÑ*­Û}ñ_ áÆoë¤ò®ÈçQSç0o)Ï6¦þÁ6wOÎUÒ<¤æK£*ÌBj©Îo3îîon3Îi¨~tÖ5$gÌÅWw(ÇÇÚ;{Wç^]*ÁÛҼ³9JóUJ5UÂ+r ͦ³Ù}{D@Ù i¹zèayÒëåi«ÑúPÓßK¥]Ƹ<rã*¾2jq[¿DúïCfö/ Әª”fá  qJÃàé’m48¦~×ú$·}ü^UBÕ÷=Æ[9㩽ÕÔy¿!èËo9|þïðóf\(î5mì]J5ʮïMºh©±Ø03ڧ+”tê2 § {Q65ȾÅ?g?¦é~ ·&F7ÓX+ה²KI}0Á$¢dÀ<üÞ}¿æqÐQ1gBmºÂ>qt?)ö̔F¹<“¢.Øgd®¢­ª1ʳß
                        dÄ! ضÁ๠&{Ïӵ”äXÕ2jmՠtñ%’´9Hó j:âãþO¼ßþPèó”ïR3V½v5º¯4ªÇY²VFÈ’¾é6÷XÍ÷MQձPE?jc0ßmćÙow44Z3ÛHè’lDV»
                        content.xml­W]oÛ6}߯4 o ͝ñß3çåhNqÀÀ+t&ה(¯à0θªkJÐPÃGTÏÑ_ɚU8ãÒX,½K߯۳èeVJWf:ñ¦ªÕKcv®­­sڶ½i7Jèé3r²̲­Ei.5¥âúv6[ Qlq¶á¬ýql׶:ɘßÝÝ!/
                        i>CyBÎzB° AùZ7Zx%ªÞ[Jsh^æ7h~3ãåx0n}ºt¶PقAïóǶ5Ó܉°ð´ü@C7cwbr­=8f۽?ÉöȲ*¦·ðnMµ¾”{J©`Î:ĐP÷¾lª¥­Y¡ C«[þ,¶g­¶[¦C©ÿ7Bkܞ
                        styles.xmlíZYã6~ß_a(ȾÑòїé , Ébw& òÐe3CIù_¿ER(Y²5ݝ`é~hÀ¬b_¼¥?ßcwȃâ”ü1OgфðD¤o£>ü=D_¿ýÛe4!ëT$eN¸FJQÌNµ尰EƎR½ Óé°
                        ¹?ü’64¤ÉQÇQsumÏøùiV+mã)ßö¦øTMr[¢lxÐժ}³)’×vSYc=¹Ê|XfĥzîJ¾¾zûæ8’j­µ÷ޮCîµÅȍdBæcgpnõnÀ§øí¿w?x~±ڪxúµ:3Áqxtnb÷»ñl¬¦£b((ù[1§6æ¤ް¥d)Mbq\Åóé¼Ng3һKnëÉDÉ!¡®*üȱ fvں%!Ä͖×è¼4ÌálÝØsu²îhÙøyZ’Ð_αUlÕex¡#¦r¾Lù²Ð켍%)Ôu0öÛѡØo*!Ùa9:(¹cà5xÛ%lÁ¸coN4;Ùgä1+8tZ_¨¬2ÇMá؝º]«æ3¦¯×!P®åЙD±f;qÕÌ`Ñ\Foý
                        X3©·oõðÄýéj¸t§Aa¡»@VÂ2ʈ0«ûα°tïΏeúõð:B4i©0sЖpðº:P¥¢ø³͘¿´'¥IÞb)¨NÜcIm[¸bä?Èïøçò2FÏhl^À$]µÉ00Jóçõ
                        ÖÜo<üÀ¾á¯ÍùEɹy@]qÑ’àV×8õ’4Xþ͓N´J~e|ԷØW«%~7Bµd^Oÿ<è÷y°Õ{_cKëõ w÷/YÇz;-ڦbwf58Ӗ3M6Áb6ÑÙâísI¡ãü݇û2¬^ð¬è.¼8_V÷þt7ìß>2Bz^.&~rS
                        ¢w;HïKJ2¼ËTcá¦Å2eø.v4<oõPDj
                        ʋ» ¢éô»®óñ*eOC)¯Ó¯Vò¡»a\­ç#/çxòë7´àÊ2c{Z½¯wWItPd4ò¸úPsµ°(aPïR3VµeppThumbnails/thumbnail.pngPNG
                        ÀêvBÒOÂôÇ=¿¹Ľ7¾%=¼ÐîFË=ãíZÁÍÀÕ;äöf*ȶKloánIáR
                        IHD¦}«FäPLTE59B:>BA;9HB?DIMCJWIMT^XT]chc[Vd]xj]afkzm}sj}uphztz|z{wz¥¥°§´°¤·¨¬³¸³«¡´»¿»¼¿®½ƷÀÇǷ§˵¢ͼ®Ù®ÒĴÅÅÃÊÉÇËËËÉÎÓÌÐÓÊÕßÐËÇÕÒÎÐÐÒÖÙÜÞÙÕÉØäÒÜäÛßäßäèéØÊàÝÚêÞÒæâÞìàÕóèÞîéæèïòæøÿíöüéüÿôïêýöìöõöö÷úôùüû÷ôýúóþþþÿÿÿ³¡ÛZGIDATxÚí׻NQÑñB¼E¢(4ÂLQD3FÀì÷!;*ûcâúªSÿ«Ø9Yèϔ`À*¯ÒFËV·0 £^é,ben5aÖGdqsßúZ d¦¥)ú hóE¡íÃ|[â-
                        C0` nXQµ;~z_L4,[è#ÜäÌîèC°b>Ô+^£ßóÎgÓۢ7ÅS?í<¥²É¾ýñ\»Ù!1r\x:Ôì5uG»&ԤÁhµ1ý§N¡èb-@<tçê1Z¸îB!ê_»S±#ÜîÃi
                        Q²ÚÆÃhNkßFÖSQòDN i\Q¿^p¾PPJ¡óp£d6½Y-nvЮÉC0`ÁËÎküÙE¦!ñͳärdÎ >Aϸ(ծËâBrAb’¸Pµ¦^[ut2½ÀfÈ-u·}\° Qòî ,+ùîNK
                        ²,§í Á!0C0`
                        |5å÷\ÅHCG9tzÍGB Á!0`Àøµá×ú9Z-)ÆûÖuU^”òl͖£ܼøhöêãF÷r°Ñ[Ú-!Æjoz§wµÎìõÐji1v¦ýÚç¨ø.Ëݨìò×O®óûv«ÝXì=Û-%Æ<U>x(ñöh6ÿøM
                        C0`À
                        C0`
                        Á
                        C0`
                        Á!0C0`
                        Á!0`À
                        Á!0`À
                        C0`À
                        C0`
                        Á
                        C0`
                        Á!0C0`
                        Á!0`À
                        Á!0`À
                        C0`À
                        C0`
                        Á
                        C0`
                        Á!0C0`
                        Á!0`À
                        Á!0`À
                        Ã0`À
                        C0`À
                        C0`
                        Á!C0`
                        Á!0`
                        Á!0`À
                        !0`À
                        C0`À
                        C0`
                        Á!C0`
                        Á!0`
                        Á!0`À
                        !0`À
                        C0`À
                        C0`
                        Á!C0`
                        Á!0`
                        Á!0`À
                        !0`À
                        C0`À
                        C0`
                        Á!C0`
                        Á!0`
                        Á!0`À
                        !0`À
                        C0`À
                        C0`
                        Á!C0`
                        Á!0`
                        Á!0`À
                        &!0`À
                        C0`À
                        C0`
                        Á
                        C0`
                        Á!0C0`
                        Á!0`ü»~VÑÙ|¬Àe8IEND®BïR3VMETA-INF/manifest.xml­Anà E÷9Ŷ2¤í¦Bq²¨Ô¤ öà áÁŷ/¶âØU)²3~ïÏïÎÑ8¬Ø+߲°vÁ¶bßǯòö]§Ðh$§EßÃxÛV,NE%ª¢¤Z:ظ:u$ÿÖËÑtÛ-¼³+Ú:¸LÜÐÊ ¤]ÂFQ®¾àâ!áHYé´65Èa4í7Å܂6Ê\ú9N֖^ѩbân®ÐURï¡bÊ{kê18cÃÇðeër
                        &Ödøt¨MoâAwLÈsë<^/ ëäÓ3ý8W½déJ¢Þá«¡ò½ÏSoáùØüh¸ÏæO©ûAel4-¹ÇöÄtª1gËNüûÕ÷¿Pöü,,%PïR3V^Æ2
                        ‘mimetypePïR3VMConfigurations2/accelerator/PïR3VConfigurations2/images/Bitmaps/PïR3VÄConfigurations2/progressbar/PïR3VþConfigurations2/statusbar/PïR3V6Configurations2/toolbar/PïR3VlConfigurations2/toolpanel/PïR3V¤Configurations2/floater/PïR3VÚConfigurations2/popupmenu/PïR3VConfigurations2/menubarïR3V´÷hÒ
                        Hmanifest.rdïR3VBmeta.xmïR3V¬Í̝_ö3
                        usettings.xmïR3Vèó”.
                        styles.xmïR3Vsµ°(a
                        content.xmlPïR3Vµepp_Thumbnails/thumbnail.pnïR3Vöü,,%META-INF/manifest.xmlPKet

                        • This reply was modified 3 months, 3 weeks ago by andfree.
                        • This reply was modified 3 months, 3 weeks ago by andfree.
                        • This reply was modified 3 months, 3 weeks ago by andfree.
                        #97785
                        Moderator
                        BobC
                          Helpful
                          Up
                          0
                          ::

                          Hmmmm, ok, look at the file in hex. You can install a hex viewer program to do that like I did.

                          The words in the .odt file look like gibberish (like what you pasted in), so grep can’t find the string in there. Midnight Commander has the same problem as grep.

                          There is a utility called odt2txt in the repos you can install that will convert .odt files to text files.

                          PS: Once odt2txt is installed, F3 in Midnight Commander will convert the file to text before bringing it up in the viewer. But mc’s search still can’t find it in the .odt file.

                          Script code adapted from here: https://unix.stackexchange.com/questions/196633/converting-for-file-in-to-find-so-that-my-script-can-apply-recursively

                          If you write a script to convert all .odt files to .txt first, and then search probably any of the search methods given will find it. In my files, I am looking for “geoblocked” in any case. My files are .odt files, and 2 are in English with that word in them.

                          # no files contain geoblocked
                          $ grep -nir "geoblocked" *
                          bobc:~/Downloads/acstv-trans-20220106-archive
                          
                          # install odt2txt program
                          $ sudo apt install odt2txt
                          [sudo] password for bobc: 
                          Reading package lists... Done
                          Building dependency tree... Done
                          Reading state information... Done
                          The following NEW packages will be installed:
                            odt2txt
                          0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
                          Need to get 15.5 kB of archives.
                          After this operation, 61.4 kB of additional disk space will be used.
                          Get:1 http://ftp.us.debian.org/debian bullseye/main amd64 odt2txt amd64 0.5-7 [15.5 kB]
                          Fetched 15.5 kB in 0s (53.0 kB/s)  
                          Selecting previously unselected package odt2txt.
                          (Reading database ... 305825 files and directories currently installed.)
                          Preparing to unpack .../odt2txt_0.5-7_amd64.deb ...
                          Unpacking odt2txt (0.5-7) ...
                          Setting up odt2txt (0.5-7) ...
                          Processing triggers for mailcap (3.69) ...
                          Processing triggers for man-db (2.9.4-2) ...
                          bobc:~/Downloads/acstv-trans-20220106-archive
                          
                          # read one page manual for odt2txt program
                          $ man odt2txt
                          bobc:~/Downloads/acstv-trans-20220106-archive
                          
                          # list directory to see what files are already there
                          $ ls -l
                          total 11560
                          -rw-r--r-- 1 bobc bobc   14220 Jan  7 18:38 meld_Bedienungsanleitung-original.de_DE-1.08.txt
                          -rw-r--r-- 1 bobc bobc    7489 Jan  7 18:38 meld_Bedienungsanleitung-original.de_DE-1.0.txt
                          -rw-r--r-- 1 bobc bobc 3912998 Jan  7 23:31 User_manual_translated.en_GB-07.01.2023.odt
                          -rw-r--r-- 1 bobc bobc   68981 Jan  7 18:38 User_manual_translated.en_GB-07.01.2023.pdf
                          -rw-r--r-- 1 bobc bobc 3911767 Jan 20 02:43 User_manual_translated.en_GB-07.01.2023x.odt
                          -rw-r--r-- 1 bobc bobc 3911308 Jan  7 18:38 VERGLEICH_Bedienungsanleitung-original.de_DE-1.08.odt
                          bobc:~/Downloads/acstv-trans-20220106-archive
                          
                          # convert the one file to text to test odt2txt program
                          $ odt2txt User_manual_translated.en_GB-07.01.2023x.odt > User_manual_translated.en_GB-07.01.2023x.odt.txt
                          bobc:~/Downloads/acstv-trans-20220106-archive
                          
                          # convert all the .odt files to text with odt2txt program
                          $ find . -name '*.odt' -exec sh -c '
                            for file do                                          
                              target="${file%.*}.txt"
                              odt2txt "$file" > "$target"
                            done' sh {} +
                          bobc:~/Downloads/acstv-trans-20220106-archive
                          
                          # list directory to see what got created
                          $ ls -l
                          total 11624
                          -rw-r--r-- 1 bobc bobc   14220 Jan  7 18:38 meld_Bedienungsanleitung-original.de_DE-1.08.txt
                          -rw-r--r-- 1 bobc bobc    7489 Jan  7 18:38 meld_Bedienungsanleitung-original.de_DE-1.0.txt
                          -rw-r--r-- 1 bobc bobc 3912998 Jan  7 23:31 User_manual_translated.en_GB-07.01.2023.odt
                          -rw-r--r-- 1 bobc bobc   68981 Jan  7 18:38 User_manual_translated.en_GB-07.01.2023.pdf
                          -rw-r--r-- 1 bobc bobc   13099 Jan 20 03:30 User_manual_translated.en_GB-07.01.2023.txt
                          -rw-r--r-- 1 bobc bobc 3911767 Jan 20 02:43 User_manual_translated.en_GB-07.01.2023x.odt
                          -rw-r--r-- 1 bobc bobc   13111 Jan 20 03:04 User_manual_translated.en_GB-07.01.2023x.odt.txt
                          -rw-r--r-- 1 bobc bobc   13111 Jan 20 03:30 User_manual_translated.en_GB-07.01.2023x.txt
                          -rw-r--r-- 1 bobc bobc 3911308 Jan  7 18:38 VERGLEICH_Bedienungsanleitung-original.de_DE-1.08.odt
                          -rw-r--r-- 1 bobc bobc   13676 Jan 20 03:30 VERGLEICH_Bedienungsanleitung-original.de_DE-1.08.txt
                          bobc:~/Downloads/acstv-trans-20220106-archive
                          
                          # search again with grep (it found it everywhere i put it)
                          $ grep -nir "geoblocked" *
                          User_manual_translated.en_GB-07.01.2023.txt:10:are not geoblocked by streaming provider for the respective
                          User_manual_translated.en_GB-07.01.2023x.odt.txt:10:are not geoblocked by streaming provider for the respective
                          User_manual_translated.en_GB-07.01.2023x.odt.txt:13:Geoblocked
                          User_manual_translated.en_GB-07.01.2023x.txt:10:are not geoblocked by streaming provider for the respective
                          User_manual_translated.en_GB-07.01.2023x.txt:13:Geoblocked
                          
                          • This reply was modified 3 months, 3 weeks ago by BobC.
                          • This reply was modified 3 months, 3 weeks ago by BobC.
                          • This reply was modified 3 months, 3 weeks ago by BobC.
                          #97795
                          Member
                          PPC
                            Helpful
                            Up
                            0
                            ::

                            To search for text inside .pdf files, from the terminal, you can adapt this (I got it from https://unix.stackexchange.com/questions/6704/how-can-i-grep-in-pdf-files)

                            Note: This requires “pdftotext” to be installed in your system

                            Replace pattern and place variables for whatever you like. The place variable, in the example below, searches everything inside your home folder.

                            pattern="my text"
                            place=$HOME
                            find $place -name '*.pdf' -exec sh -c 'pdftotext "{}" - | grep --with-filename --label="{}" --color "$pattern"' \;

                            Edit:
                            A tool to search for text side pdf, documents, ebooks is available here: https://phiresky.github.io/blog/2019/rga–ripgrep-for-zip-targz-docx-odt-epub-jpg/
                            I’m currently trying to test it

                            • This reply was modified 3 months, 3 weeks ago by PPC.
                            • This reply was modified 3 months, 3 weeks ago by PPC.
                            #97799
                            Moderator
                            BobC
                              Helpful
                              Up
                              0
                              ::

                              Or for .odt files, stealing PPC’s solution and tweaking it a bit (I had problems passing the pattern to grep)…

                              PS: Be careful copying the code as it stretches about double the width of the box

                              $ pattern="geoblocked"
                              $ place="." 
                              $ find $place -name '*.odt' -exec sh -c 'odt2txt "{}" | grep -i --with-filename --label="{}" --color "'"$pattern"'" | grep -i "'"$pattern"'"' \;
                              ./User_manual_translated.en_GB-07.01.2023x.odt:are not geoblocked by streaming provider for the respective
                              ./User_manual_translated.en_GB-07.01.2023x.odt:Geoblocked
                              ./User_manual_translated.en_GB-07.01.2023.odt:are not geoblocked by streaming provider for the respective
                              
                              • This reply was modified 3 months, 3 weeks ago by BobC.
                              #97801
                              Member
                              PPC
                                Helpful
                                Up
                                0
                                ::

                                Hum… I’m almost tempted to create a yad GUI for searching documents: .txt, .pdf and .odt and make it available in FT10… But there’s already rip-grep, recoil, etc… and that could be superfluous, since there are very good tools already available.

                                Off topic:
                                Having a “Universal” search icon on the menu/toolbar, that allows users to enter a search term and has checkboxes like: “Search for Applications”; “Search the Web with dddgr”; “Search for File name”; “Search for Content inside .txt, .pdf and .odt documents” would be neat… hum…

                                P.

                                #97808
                                Member
                                PPC
                                  Helpful
                                  Up
                                  0
                                  ::

                                  I’m not sure if anything I installed in my computer added any functionality to searchmonkey, but it does search files by name and contents, including text files, .pdf, odt, doc and docx !
                                  You get a preview of where in the file the text is found, on a panel on the lower right.
                                  You can even perform searches from the terminal. From the help file:

                                  how to launch Searchmonkey with parameters :
                                  searchmonkey -d {directory} -f {file name} -t {containing text}
                                  Example :
                                   searchmonkey -d /home/tux/documents -f txt -t linux

                                  If you start the search from the terminal, you do have to press enter, on the GUI, in order for the search to start.

                                  My single problem with searchmonkey is that it’s not localized in my language, making it harder to be used by non English speaking users- I did create a localization file for it, that I tested on my old computer (and sent to Marcelo, if I recall correctly).
                                  I may create a simple GUI for it (that I can localize myself). Probably, if I do that, the GUI will ask if the user wants to perform a web search (displaying the results in the GUI I created for ddgr) or search files/documents on the local computer.
                                  For searching installed applications users have appselect (or the menu search, if they are using FT10). For searching for “installable” applications users can try Package Installer and then Synaptic.
                                  Overall, antiX provides nice GUI ways to search for files by text content (or even apps by description)

                                  On my computers, searchmonkey (installed by default in antiX full) never failed me.

                                  Edit: if you want to use searchmonkey from the terminal, without having to press enter to start the search try something like this:

                                  searchmonkey -d $HOME -f .doc -t antix & sleep 5 && xdotool key KP_Enter

                                  This will search, all documents inside your home folder, that include the “doc” in their name/extension and include “antix” inside them [adapt to search for files with the name you want, anywhere, with any content].

                                  P.

                                  • This reply was modified 3 months, 3 weeks ago by PPC.
                                Viewing 15 posts - 1 through 15 (of 34 total)
                                • You must be logged in to reply to this topic.