I tried Advanced Search
and found a post by The Rube Advanced option or tricks to find dupe with partial names, then remembered about adding columns, so added (for type DOCument) a "LineCount" column, but this returned null line-counts:- and now i am stuck.
I believe I am forgetting something very basic, and so beg for guidance!
I have exported about ninety VBA modules from a MSWord utility library.
The files are stored on a B: drive as *.TXT files (as in the image above).
I have attached a single file to show its content; my programming standards are to use "Option Explicit", hence the use of the string "option" as an argument to CONTENT: in the search string.
Please and Thank You: Everything can do Everything, so I believe that there is a simple way to report the size of TXT files as a count of the number of lines within each file. With that data I can SUM() the counts to determine the total size of the task ahead of me in this, the first of seventeen templates that need to be examined/converted.
Cheers, Chris
Count Lines in Text files
-
ChrisGreaves
- Posts: 821
- Joined: Wed Jan 05, 2022 9:29 pm
Count Lines in Text files
- Attachments
-
- UT_strINGS.txt
- (90.51 KiB) Downloaded 86 times
Re: Count Lines in Text files
The Line Count property is added by specific applications. Don't know which ones exactly, but MS Word (doc,docx) seems likely.
For plain text files, Everything has its own property.
To add it to your result list:
Anticipating your next question:
No, there is no option to show the aggregated number of lines in the status bar.
For plain text files, Everything has its own property.
To add it to your result list:
- Right-click the header of the result list (for example the Name column)
- Select Add Columns from the context menu
- In the left pane, select text/plain
(you might need to scroll down for that) - In the right pane, select Plain Text Line Count
- Press the OK button
- Done.
Anticipating your next question:
No, there is no option to show the aggregated number of lines in the status bar.
-
ChrisGreaves
- Posts: 821
- Joined: Wed Jan 05, 2022 9:29 pm
Re: Count Lines in Text files
Thank you NotNull.NotNull wrote: Tue May 27, 2025 8:48 pmFor plain text files, Everything has its own property.
To add it to your result list:
My mistake was in not examining the entire dialogue box/pane for anything past the FIRST occurrence of the phrase "line count".
I think I was supposed to know that by now ...
You take all the fun out of forumsAnticipating your next question:No, there is no option to show the aggregated number of lines in the status bar.
I am knee deep in Win11/Office21, so I fired up Excel and double-clicked the SUM function after exporting the results as a CSV file.
Thanks again!
Chris
-
ChrisGreaves
- Posts: 821
- Joined: Wed Jan 05, 2022 9:29 pm
Re: Count Lines in Text files
Today saw the first delivery of grass clippings.ChrisGreaves wrote: Tue May 27, 2025 11:55 pmMy mistake was in not examining the entire dialogue box/pane for anything past the FIRST occurrence of the phrase "line count".
And if you think that THAT is exciting, take a look at what appeared when I came inside for a break:- I am in the process of migrating from Win7/Word2003 to Win11/Office21, and my first task is to migrate my utility library, UW*.dot.
The image shows a list sorted by date-modified.
The first entry was modified yesterday and is probably corrupt in some way.
The second entry is but one line long, but there again, it is a status flag of some sort for MSWord.
The third entry, UW538 is probably my best bet; I should mark it Read-Only and use that as a starting point.
BUT LOOK! Armed with NotNull's help, Everything has reported a Plain Text Line Count for each version of the template.
This line count will include huge blocks of code that I have commented-out, disabled code that I am reluctant to delete; Everything, I am sure, just sees "a line of VBA code" and adds 1 to the count.
Still and all, It seems to me that there was no need to download and install a bit of code to export VBA Modules to disk, create a result list, and so on.
Everything astounds me!
Cheers, Chris
Re: Count Lines in Text files
Plain Text Line Count will not work as you expect for DOT files as they are not text/plain.
The Line Count property is a "metadata" property (it's pre-calculated and stored in the file header and is fast)
The Plain Text Line Count property has to read the entire content of the file (slow)
Not all files support the Line Count property.
It is mostly supported by Office documents.
For DOC, DOCX and DOT files, please try the Line Count property.
For TXT files, please try the Plain Text Line Count property.
Alternatively, try the following search to count the actual number of lines from the file content: (txt, doc, docx and dots files):
Please note that gathering this information will be slow.
Alternatively, a faster search:
This version will use the line count metadata if it is available. If not, it is calculated from the file content.
The Line Count property is a "metadata" property (it's pre-calculated and stored in the file header and is fast)
The Plain Text Line Count property has to read the entire content of the file (slow)
Not all files support the Line Count property.
It is mostly supported by Office documents.
For DOC, DOCX and DOT files, please try the Line Count property.
For TXT files, please try the Plain Text Line Count property.
Alternatively, try the following search to count the actual number of lines from the file content: (txt, doc, docx and dots files):
add-column:A A:=LINECOUNT($content:) A-label:"Line Count"Please note that gathering this information will be slow.
Alternatively, a faster search:
add-column:A A:=$line-count:?$line-count::LINECOUNT($content:) A-label:"Line Count"This version will use the line count metadata if it is available. If not, it is calculated from the file content.