Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

DOS utility to display 1st line of all files in directory? (Users)

posted by CluelessInSeattl, Seattle, USA, 19.12.2012, 17:55

Thanks Rugxulo!

I'm going to take your batch file (see below) for a spin. Years ago I used to write a lot of batch files and had a heck of a lot of fun doing it. But that was a decade or more ago, so I'm rusty now. But your little batch file will give me something to play with and try to get back up to speed.

I don't have QBasic installed on my computer, so I figure I'll have to try to find it on an old floppy and install it before your file will work; right? (What do I need to do besides copying the QBasic files to a directory and adding the directory to my path?).

I'm only able to work a few minutes a day at my computers, so this may take me a day or two to get set up.

In the meantime, will your batch file look at the first line of all files in a directory, not just the ones with .txt extension? I use an alpha/numeric code for the three character file extensions as a way of tagging files.

Also, could I add a routine to your batch file so that it would sort the first lines into alpha/numeric order?

Will in Seattle
a.k.a. "Clueless"

> Anyways, here's a quick .BAT / .BAS combo I whipped up that should work
> verbatim in MS-DOS 6. (I assume this does what you want, otherwise you
> might have to use
> Sed,
> Awk,
> Edlin, or similar utility from wherever):
>
>
> @echo off
> REM Usage:  for %a in (*.txt) do call oneline.bat %a
> set B1=%TEMP%.\oneline.bas
> echo OPEN ENVIRON$("MYFILE") FOR INPUT AS #1 >%B1%
> echo INPUT #1, line$ : PRINT line$ >>%B1%
> echo CLOSE >>%B1%
> echo SYSTEM >>%B1%
> :begin
> set MYFILE=%1
> qbasic /run oneline.bas
> for %%z in (MYFILE B1) do set %%z=
>

---
Will in Seattle
a.k.a. "Clueless"
Running MS-DOS 6.21

 

Complete thread:

Back to the forum
Board view  Mix view
22762 Postings in 2122 Threads, 402 registered users (1 online)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum