Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

commands$

9 views
Skip to first unread message

Big-Dave

unread,
Sep 10, 2003, 2:35:30 PM9/10/03
to
' Hi, this works fine without the {outFile$ = UCASE$(COMMAND$)}
' What I want to acomplish is at the command line i want to...
' addlines myfile.txt new-file.txt
' Thanks
' Dave
'
'
' Inserts 2 blank lines every 60 lines
$CPU 8086 ' program works on any CPU
DEFINT A-Z ' default all variables to integers for maximum
' speed and minimum size

inFile$ = UCASE$(COMMAND$) 'get the infile filespec
outFile$ = UCASE$(COMMAND$) 'get the outfile filespec

CLS

STDOUT "Add 2 blank lines every 60 lines"
STDOUT "Copyright (c) 2003 by dlb. All Rights Reserved."
STDOUT
'-------------------------------

IF LEN(inFile$) = 0 THEN
STDOUT "Usage: ADDLINE InFile.txt OutFile.txt"
STDOUT
END 1
END IF

'-------------------------------
OPEN inFile$ FOR INPUT AS #1
OPEN outFile$ FOR OUTPUT AS #2
'-------------------------------

DO WHILE NOT EOF(1)
LINE INPUT #1, a$
PRINT #2, a$
count = count + 1
IF count / 60 = INT(count / 60) THEN PRINT #2, ""
PRINT #2, ""
LOOP

'----------
CLOSE #1
CLOSE #2' THE
END

Dr.Bob

unread,
Sep 10, 2003, 4:31:41 PM9/10/03
to
Dave,

This kind of thing works in a simplistic form:

Function PbMain()
Dim sInput$, sInfile$, sOutfile$
Dim nPos&

sInput$ = Command$

nPos& = InStr(sInput$," ")
If nPos& Then
sInfile$ = UCase$(Trim$(Left$(sInput$,nPos&)))
sOutfile$ = UCase$(Trim$(Right$(sInput$,Len(sInput$) - nPos&)))
Else
stdout "MyUtil useage:"
stdout "MyUtil inputfilename outputfilename"
Exit Function
End If

stdout "Input file is: " & sInfile$
stdout "Output file is: " & sOutfile$

End Function

However, if you might be using longfilename fully qualified filenames, then
you'd need to start parsing for double-quotes, etc.

"Big-Dave" <dl...@sstar.com> wrote in message
news:bjnqtm$fao$1...@news.datasync.com...

Robert Wolfe

unread,
Jan 16, 2019, 1:10:47 AM1/16/19
to
On 9/10/03 11:35 AM, Big-Dave wrote:
> ' Hi, this works fine without the {outFile$ = UCASE$(COMMAND$)}
> ' What I want to acomplish is at the command line i want to...
> ' addlines myfile.txt new-file.txt

Perhaps you are looking for code like this:

s$ = UCASE$(COMMAND$) 'get the files you want to process
sp = instr(s$, " ") 'Get the position of the space character
i$ = left$(s$, len(s$) - sp) 'Pull the name of the input file
o$ = right$(s$, len(s$) - sp) 'Pull the name of the output file
print "input file: "; i$ 'Show the name of the input file
print "output file: "; o$ 'Show the name of the output file

Hope this helps as a starting point.
0 new messages