Find in files - lines of a text file
Moderators: white, Hacker, petermad, Stefan2
Find in files - lines of a text file
Hello TCMD Fans,
I have a text file with several lines of text separated by CR/LF pairs.
I need to find those files in a dir that contains ANY line of the text file.
TCMD search dialog's "Find text" box is not suitable, because that allows only a single line of text to search for.
Can anyone please suggest me a plugin (or some special trick) that allows this search to execute ?
Thanks a lot in advance,
Peter
I have a text file with several lines of text separated by CR/LF pairs.
I need to find those files in a dir that contains ANY line of the text file.
TCMD search dialog's "Find text" box is not suitable, because that allows only a single line of text to search for.
Can anyone please suggest me a plugin (or some special trick) that allows this search to execute ?
Thanks a lot in advance,
Peter
#212615 Single user licence
Re: Find in files - lines of a text file
From the help:BlueWings wrote: ↑2019-06-11, 13:28 UTC Hello TCMD Fans,
I have a text file with several lines of text separated by CR/LF pairs.
I need to find those files in a dir that contains ANY line of the text file.
TCMD search dialog's "Find text" box is not suitable, because that allows only a single line of text to search for.
Can anyone please suggest me a plugin (or some special trick) that allows this search to execute ?
Thanks a lot in advance,
Peter
Find text If this option is checked, you can enter text to be searched.
With \t you find tabstops, and with \n line breaks (ENTER) in texts.
To find a backslash \, you need to give it twice: \\ .
Did you try it with your search criteria ?
Windows 11 Home x64 Version 23H2 (OS Build 22631.3527)
TC 11.03 x64 / x86
Everything 1.5.0.1375a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.78
QAP 11.6.3.3 x64
TC 11.03 x64 / x86
Everything 1.5.0.1375a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.78
QAP 11.6.3.3 x64
Re: Find in files - lines of a text file
2Horst.Epp
TC would search exactly for this string, i.e. the lines in this exact order. That's probably not what he wants.
Unfortunately I don't have a good idea right now.
Regards
Dalai
TC would search exactly for this string, i.e. the lines in this exact order. That's probably not what he wants.
Unfortunately I don't have a good idea right now.
Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Re: Find in files - lines of a text file
Hello Horst,
I want to find those files in a dir that contains at least 1 line of a text file (but can probably contain more).
For a small amount of lines that's easy to copy-paste each line into the search dialog's edit box, but I have some files with several hundred lines, and I have about 15 computers to do this task upon.
Thanks a lot,
Peter
That's not good unfortunately, because my goal is to find files that contain only one singe line of a multiple lines text file.
I want to find those files in a dir that contains at least 1 line of a text file (but can probably contain more).
For a small amount of lines that's easy to copy-paste each line into the search dialog's edit box, but I have some files with several hundred lines, and I have about 15 computers to do this task upon.
Thanks a lot,
Peter
#212615 Single user licence
Re: Find in files - lines of a text file
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Re: Find in files - lines of a text file
Finally I decided to choose a little bit different approach, and was able to reduce the possible search patterns downto exectly 2.
Then I got the relevant files with this script :
(which would also be possible with 2 searches in TC)
https://www.dostips.com/?t=batch.findandreplace
Cheers & t(h)anks :
Peter
Then I got the relevant files with this script :
(which would also be possible with 2 searches in TC)
Code: Select all
find /c "searchpattern1" dir01\*.txt > list1.lst
find /c "searchpattern2" dir01\*.txt >> list1.lst
type list1.lst | findstr /C:": 1" > list2.lst
call BatchSubstitute "---------- DIR01" "DIR01" list2.lst > list3.lst
call BatchSubstitute ": 1" "" list3.lst > list4.lst
for /F "delims=" %%i in (list4.lst) do copy /Y "%%i" "dir02\"
del list?.lst
Cheers & t(h)anks :
Peter
#212615 Single user licence
Re: Find in files - lines of a text file
Why aren't you using the existing content plugins Textsearch or Filecontent for your task? Have a look at Image: https://tbeu.de/forum/filecontent.png for an example.
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more