UK Vintage Radio Repair and Restoration Powered By Google Custom Search Vintage Radio Service Data

Go Back   UK Vintage Radio Repair and Restoration Discussion Forum > Specific Vintage Equipment > Vintage Computers

Notices

Vintage Computers Any vintage computer systems, calculators, video games etc., but with an emphasis on 1980s and earlier equipment.

Reply
 
Thread Tools
Old 24th Aug 2019, 3:17 pm   #1
brenellic2000
Octode
 
Join Date: Aug 2006
Location: Rye, East Sussex, UK.
Posts: 1,500
Default Word in file search utility, DOS

Years ago (20+!) there was a useful DOS utility which allowed one to search the location of a particular word in any number of files on the PC, similar to /S command, but in a far greater internal depth.

Can anyone remember what it's called... and is it still around in DOS or W3.1?
brenellic2000 is offline   Reply With Quote
Old 24th Aug 2019, 6:10 pm   #2
GeoffB17
Triode
 
Join Date: Feb 2016
Location: Guisborough, North Yorkshire, UK.
Posts: 38
Default Re: Word in file search utility, DOS

I never saw such a thing, as you describe it, but I wrote a somewhat limited version for my own use, which I still use.

This works on text files ONLY, in the current directory. It's looking for all 'hits' of a specified word. I use it mainly for following variables, keywords, etc in modules of source code. The prog defaults to *.c, but other things can be added to the command line like *.prg or *.txt, *.htm etc.

The result is put to a file, comprising a header for each filename, then line number and (part) of the full text of the line.

It's a DOS prog, so it's 8.3 filenames only. This has been causing me some trouble recently, so maybe I should change it?

Any help?

Geoff
GeoffB17 is offline   Reply With Quote
Old 24th Aug 2019, 7:33 pm   #3
buggies
Hexode
 
buggies's Avatar
 
Join Date: Jan 2009
Location: West Lothian, UK.
Posts: 358
Default Re: Word in file search utility, DOS

Was it not simply "Find" ?

https://sites.google.com/site/pcdosr...mands#TOC-FIND
Pasted from the above site:-

___________________________________
FIND
External - DOS 2.0 and above

Searches for a text string in a file or files.

FIND [/V] [/C] [/N] [/I] [/S] "string" [[drive:][path]filename[ ...]]

/V Displays all lines NOT containing the specified string.
/C Displays only the count of lines containing the string.
/N Displays line numbers with the displayed lines.
/I Ignores the case of characters when searching for the string.
/S Search subdirectories also.
"string" Specifies the text string to find.
[drive:][path]filename
Specifies a file or files to search.

If a pathname is not specified, FIND searches the text typed at the prompt
or piped from another command.
/I is only available in DOS 5 and above.
/S is only available in PC DOS 7.
Also PC DOS 7 allows the use of wildcards in filenames while prior versions do not.
_______________________________________
__________________
George
buggies is offline   Reply With Quote
Old 24th Aug 2019, 8:26 pm   #4
Alistair D
Octode
 
Alistair D's Avatar
 
Join Date: Jan 2010
Location: Edinburgh, UK.
Posts: 1,632
Default Re: Word in file search utility, DOS

I used to use a program called Xtree Gold. Among the many file reading and manipulation functions was one that could search a selection of files for any chosen word or phrase.

Al
__________________
I won't tell you how I discovered that.
Alistair D is online now   Reply With Quote
Old 24th Aug 2019, 10:19 pm   #5
emeritus
Dekatron
 
Join Date: Jan 2012
Location: Brentwood, Essex, UK.
Posts: 3,250
Default Re: Word in file search utility, DOS

I paid 10p for a copy of "Field Guide to MS DOS 6.2" in a charity shop some years ago. A quick scan through it suggests that the commands FIND, FOR, and SORT, together with "piping" , can be used to search for text strings in a multiple files. Examples are given. Scans of the relevant pages attached.

No personal experience with using any of these commands. I have only used the book once, when the driver software for a LCD monitor for my WIN 98 PC managed to mess up the system so badly that I had to operate the PC in command mode, echoing the screen to a printer, to get it working again.

I loved Xtree Gold: we used to use it at GEC in the early 1990's. I still have a copy of the software on a floppy, but I couldn't get it to run on my PC.
Attached Files
File Type: pdf MSDOS 6.2.pdf (1.27 MB, 19 views)

Last edited by emeritus; 24th Aug 2019 at 10:24 pm.
emeritus is offline   Reply With Quote
Old 25th Aug 2019, 4:33 am   #6
arjoll
Nonode
 
arjoll's Avatar
 
Join Date: May 2006
Location: Invercargill, New Zealand
Posts: 2,493
Default Re: Word in file search utility, DOS

FIND will do that in a basic fashion.

Often I find it's useful to search for a particular word or phrase in a number of text files - specifically scripts for an accounting package I support, looking for things like a particular table or index name. FIND was always a little clunky for that, so I just wrote a little VB.NET program to do it - the guts of it is:

Code:
Dim di As New DirectoryInfo(strPath)
Dim files = From fi In di.EnumerateFiles(strType, SearchOption.AllDirectories)

For Each fi As FileInfo In files
  Dim findstring = IO.File.ReadAllText(fi.FullName).ToLower
  If findstring.Contains(strFind) Then
    Console.WriteLine("Found in {0}", fi.FullName)
  End If
Next
strFind is the lowercase text to find, strType is the file extension, and strPath is the directory to start from. Could be just as easily done in C#. Won't be much use in MSDOS though, but you could do similar things - I'd need to fire up DOSBox and see what the options are in QuickC.
arjoll is offline   Reply With Quote
Old 25th Aug 2019, 8:47 am   #7
cheerfulcharlie
Heptode
 
Join Date: May 2009
Location: Birmingham, West Midlands, UK.
Posts: 543
Default Re: Word in file search utility, DOS

Quote:
Originally Posted by Alistair D View Post
I used to use a program called Xtree Gold. Among the many file reading and manipulation functions was one that could search a selection of files for any chosen word or phrase.

Al
A great program, made me understand PCs better in those early days.
They did one later called 'Xtree for Windows'
which was around in the Windows 3/95/era
cheerfulcharlie is offline   Reply With Quote
Old 25th Aug 2019, 9:15 am   #8
brenellic2000
Octode
 
Join Date: Aug 2006
Location: Rye, East Sussex, UK.
Posts: 1,500
Default Re: Word in file search utility, DOS

Thanks lads. I still use XTree on occasion but don't recall any 'find' facility... perhaps its only in Gold? I'll have a look and play with Find in DOS... meanwhile I'll continue searching for my old software catalogue!
brenellic2000 is offline   Reply With Quote
Old 25th Aug 2019, 3:42 pm   #9
brenellic2000
Octode
 
Join Date: Aug 2006
Location: Rye, East Sussex, UK.
Posts: 1,500
Default Re: Word in file search utility, DOS

Back agin! Been playing with the FIND command but while it works fine entering a single, known file name, it doesn't handle a batch of files, or wild cards... but it does the job, laboriously, for my immediate needs.

How does XTGold differ - does it search through a batch of files and sub-directories? (I have the earlier XTree Pro).

Barry
brenellic2000 is offline   Reply With Quote
Old 25th Aug 2019, 5:55 pm   #10
julie_m
Dekatron
 
Join Date: May 2008
Location: Derby, UK.
Posts: 7,331
Default Re: Word in file search utility, DOS

That sounds like the `grep` command in Unix. I'm fairly sure someone ported GNU grep (a popular Free and Open Source implementation of `grep`) to MS-DOS a long time ago.
__________________
If I have seen further than others, it is because I was standing on a pile of failed experiments.
julie_m is offline   Reply With Quote
Old 25th Aug 2019, 6:57 pm   #11
emeritus
Dekatron
 
Join Date: Jan 2012
Location: Brentwood, Essex, UK.
Posts: 3,250
Default Re: Word in file search utility, DOS

Page 74 of the attachment I posted shows you how to do a wildcard search by combining FOR and FIND.
emeritus is offline   Reply With Quote
Old 25th Aug 2019, 9:32 pm   #12
arjoll
Nonode
 
arjoll's Avatar
 
Join Date: May 2006
Location: Invercargill, New Zealand
Posts: 2,493
Default Re: Word in file search utility, DOS

Quote:
Originally Posted by brenellic2000 View Post
Back agin! Been playing with the FIND command but while it works fine entering a single, known file name, it doesn't handle a batch of files, or wild cards... but it does the job, laboriously, for my immediate needs.
Try something like:
Code:
for %f in (*.doc) do find /n /i "text" %f
arjoll is offline   Reply With Quote
Old 26th Aug 2019, 9:40 am   #13
brenellic2000
Octode
 
Join Date: Aug 2006
Location: Rye, East Sussex, UK.
Posts: 1,500
Default Re: Word in file search utility, DOS

Thanks Arjoll, your "for %f in (*.doc)...." etc works fine, except for one problem... screen scrolling speed! There does not appear to be a 'by page' command (/p, |more etc or indeed ScrollLock on the keyboard) which works.

While it merrily flashes through all those files not containing the selected text, by the time it finds one which does, it is too late to hit 'Pause' - the file name having scrolled off the screen!

Is there a way of scrolling page by page, or slowing down the scroll speed, or going back a page??
brenellic2000 is offline   Reply With Quote
Old 26th Aug 2019, 10:45 am   #14
Station X
Moderator
 
Station X's Avatar
 
Join Date: Jan 2003
Location: Ipswich, Suffolk, IP4, UK.
Posts: 15,007
Default Re: Word in file search utility, DOS

From what I remember you enter " | more" (note leading space) at the end of the command line and then use the space bar to step to the next page.
__________________
Graham. Forum Moderator

Keep the soldering iron hot.
Station X is offline   Reply With Quote
Old 26th Aug 2019, 10:50 am   #15
G6Tanuki
Dekatron
 
G6Tanuki's Avatar
 
Join Date: Apr 2012
Location: Wiltshire, UK.
Posts: 7,518
Default Re: Word in file search utility, DOS

What you could do is redirect the output to a file, then use your editor-of-choice to view the file.

If you issue the command then put "> C:\junkfile.txt" on the end, the output of your command will end up in c:\junkfile.txt for your later perusal.

See https://www.robvanderwoude.com/redirection.php
G6Tanuki is offline   Reply With Quote
Old 26th Aug 2019, 11:51 am   #16
arjoll
Nonode
 
arjoll's Avatar
 
Join Date: May 2006
Location: Invercargill, New Zealand
Posts: 2,493
Default Re: Word in file search utility, DOS

Unfortunately piping through MORE as Graham suggested won't work here - it'll do the pipe on each individual iteration of FIND, not on the whole run.

G6Tanuki is close, but use >> file.txt instead - that will append each run to the file. With a single > you'll overwrite with each run and only ever get the results for the first file.

Trying something like:
More < for %f in...
May work as well, but I am not on my PC so can't check. I'll have a look in the morning NZ time.
arjoll is offline   Reply With Quote
Old 26th Aug 2019, 3:43 pm   #17
brenellic2000
Octode
 
Join Date: Aug 2006
Location: Rye, East Sussex, UK.
Posts: 1,500
Default Re: Word in file search utility, DOS

Thanks,

While G6Tanuki's and Arjoll's improved save-to-file trick now makes it a manageable tool through EDLIN, I'm finding that it is very selective in reporting those files that contain the target word(s), correctly spelt, ignoring several files which I know for certain do! I'm mystified... but at any rate this fundamental unreliability makes the whole exercise rather pointless and I'm frankly better of using my instinct and the basic Type and Edit commands! Progress, eh?!

Anyway thanks very much for all your help - much appreciated as ever. Back to square one...

Barry
brenellic2000 is offline   Reply With Quote
Old 26th Aug 2019, 8:25 pm   #18
Oldcodger
Octode
 
Join Date: Oct 2014
Location: West Midlands, UK.
Posts: 1,346
Default Re: Word in file search utility, DOS

Quote:
Originally Posted by Alistair D View Post
I used to use a program called Xtree Gold. Among the many file reading and manipulation functions was one that could search a selection of files for any chosen word or phrase.

Al
Xtree works ( to a limited extent on up to ,I think W7(,but there's a modern version that has no file length called Ztree.
Oldcodger is offline   Reply With Quote
Old 26th Aug 2019, 9:36 pm   #19
kalee20
Dekatron
 
Join Date: Feb 2007
Location: Lynton, N. Devon, UK.
Posts: 5,062
Default Re: Word in file search utility, DOS

Xtree gold is what I remember too. But it is limited in its ability to search within each file, as it has to be able to open and read each one to do so. I seem to remember it couldn't understand WordPerfect 5.1 files, for instance, so didn't find the search text if it was in one of these files.
kalee20 is online now   Reply With Quote
Old 27th Aug 2019, 1:04 am   #20
arjoll
Nonode
 
arjoll's Avatar
 
Join Date: May 2006
Location: Invercargill, New Zealand
Posts: 2,493
Default Re: Word in file search utility, DOS

Quote:
Originally Posted by brenellic2000 View Post
I'm finding that it is very selective in reporting those files that contain the target word(s), correctly spelt, ignoring several files which I know for certain do!
Quote:
Originally Posted by kalee20 View Post
I seem to remember it couldn't understand WordPerfect 5.1 files, for instance, so didn't find the search text if it was in one of these files.
It sounds like a file format issue. FIND will just search for text within a file - if it's got control codes and other data in the middle of the word then it won't find it, and the same goes if the word you're looking for appears after an EOF character (^Z).
arjoll is offline   Reply With Quote
Reply

Thread Tools



All times are GMT +1. The time now is 12:57 pm.


All information and advice on this forum is subject to the WARNING AND DISCLAIMER located at https://www.vintage-radio.net/rules.html.
Failure to heed this warning may result in death or serious injury to yourself and/or others.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Copyright ©2002 - 2019, Paul Stenning.