Search found 1919 matches

by Aacini
10 Jan 2012 19:24
Forum: DOS Batch Forum
Topic: add code to multiple files by line number?
Replies: 17
Views: 17802

Re: add code to multiple files by line number?

The *.TMP files have the contents you said, but the *.OUT files should have the right result. Please post a small .php test file and the .out produced file you got.
by Aacini
10 Jan 2012 11:22
Forum: DOS Batch Forum
Topic: add code to multiple files by line number?
Replies: 17
Views: 17802

Re: add code to multiple files by line number?

Excuse me. It seems I confused a preliminary version of the program instead of the good one. I fixed the errors in the original program above. Please copy it again. Sorry... :|
by Aacini
09 Jan 2012 17:59
Forum: DOS Batch Forum
Topic: add code to multiple files by line number?
Replies: 17
Views: 17802

Re: add code to multiple files by line number?

Ops! This line is wrong:

Code: Select all

findstr /N ^^ "%%f% > "%%Nf.tmp"
It should be:

Code: Select all

findstr /N ^^ "%%f" > "%%Nf.tmp"
by Aacini
08 Jan 2012 20:44
Forum: DOS Batch Forum
Topic: Mechanics of reading a file with FOR /F
Replies: 11
Views: 11421

Re: Mechanics of reading a file with FOR /F

Here is evidence that GOTO command not always terminate a FOR loop that read a file; in particular, when an Overlay Batch file is executed before the GOTO. This is the Main file: @echo off for /F "delims=" %%a in (%1) do echo Main: "%%a" & Overlay "%%a" & goto q...
by Aacini
06 Jan 2012 21:19
Forum: DOS Batch Forum
Topic: add code to multiple files by line number?
Replies: 17
Views: 17802

Re: add code to multiple files by line number?

If you mean insert a new line in the position 14, and shift the rest of lines one position, the Batch file below solve your problem: @echo off setlocal EnableDelayedExpansion for %%f in (*.php) do ( findstr /N ^^ "%%f" > "%%~Nf.tmp" echo :EOF>> "%%~Nf.tmp" call :InsertL...
by Aacini
06 Jan 2012 20:27
Forum: DOS Batch Forum
Topic: Drawing rudimentary graphics in text mode
Replies: 46
Views: 74720

Re: Drawing rudimentary graphics in text mode

I just realized that the definition of ColorMsg.com auxiliary program may be included in the Batch file. At beginning of the Batch file include this line: if not exist ColorMsg.com call :DefineColorMsg And at the end: :DefineColorMsg setlocal DisableDelayedExpansion set ColorMsg=³2ÿŠOÿ2íã9‹û° üó®tQ...
by Aacini
05 Jan 2012 23:30
Forum: DOS Batch Forum
Topic: Drawing rudimentary graphics in text mode
Replies: 46
Views: 74720

Re: Drawing rudimentary graphics in text mode

Jeb: that is awesome! Mandelbrot Set color bands in the "sea" becomes narrow as we approach to the "land" (the black area). To compensate for this effect, several bands must be joined in the same color as the iteration level increases. I wrote a very small and fast program to sho...
by Aacini
05 Jan 2012 11:46
Forum: DOS Batch Forum
Topic: Piped input and output to a batch file
Replies: 18
Views: 30300

Re: Piped input and output to a batch file

Excuse me, perhaps I didn't expressed it correctly. SET /P is the only way a Batch file have to get piped input if it use built-in (cmd.exe internal) Batch commands only . If an external executable file is used, then anything is possible, right? We used to use FINDSTR command for several purposes al...
by Aacini
04 Jan 2012 12:55
Forum: DOS Batch Forum
Topic: Processing a group of files at a time in a single folder
Replies: 3
Views: 4592

Re: Processing a group of files at a time in a single folder

Ops! My fault on forget that SET /A... To check if there are missed files after the FOR ends, just check if fiveFiles variable is not empty: @echo off setlocal EnableDelayedExpansion set i=0 set group=0 set "fiveFiles=" for %%f in (*.*) do ( set "fiveFiles=!fiveFiles! %%f" set /A...
by Aacini
03 Jan 2012 23:56
Forum: DOS Batch Forum
Topic: Processing a group of files at a time in a single folder
Replies: 3
Views: 4592

Re: Processing a group of files at a time in a single folder

I don't know how to rar 5 files at a time (and you don't show it), so I suppose it is achieved this way: rar options.. file1 file2 file3 file4 file5 /output=name If so, then the Batch file below solve your problem: @echo off setlocal EnableDelayedExpansion set i=0 set group=0 set "fiveFiles=&qu...
by Aacini
03 Jan 2012 23:34
Forum: DOS Batch Forum
Topic: Drawing rudimentary graphics in text mode
Replies: 46
Views: 74720

Re: Drawing rudimentary graphics in text mode

3- Had you seen fractal graphics? The Mandelbrot Set is drawn on a complex plane of Z=X+iY coordinates. At each (X0,Y0) point, Zn+1=Zn^2-Z0 (Xn+1=Xn^2-Yn^2-X0)+i(Yn+1=2*Xn*Yn-Y0) is iterated until |Z|=SQRT(X^2+Y^2) is greater than 2; the number of iterations gives the color of that point. If |Z| don...
by Aacini
03 Jan 2012 23:33
Forum: DOS Batch Forum
Topic: Drawing rudimentary graphics in text mode
Replies: 46
Views: 74720

Re: Drawing rudimentary graphics in text mode

2- We pass now to a more technical matter. The following program use extensive Fixed Point arithmetic operations to graphic a complex algebraic equation: the projection of a 3D-surface on the X-Y plane. @echo off ::Floating-point graphics in text mode via integer operations ::Antonio Perez Ayala - J...
by Aacini
03 Jan 2012 23:32
Forum: DOS Batch Forum
Topic: Drawing rudimentary graphics in text mode
Replies: 46
Views: 74720

Drawing rudimentary graphics in text mode

Although graphic applications had been used for years as the "computer standard", text mode may still be used to show interesting graphics (like 25 years ago!). Note that "rudimentary" term refer to the graphics presentation, not to the graphic contents. Batch programs below use ...
by Aacini
03 Jan 2012 22:59
Forum: DOS Batch Forum
Topic: Piped input and output to a batch file
Replies: 18
Views: 30300

Re: Piped input and output to a batch file

Yes you are right, but SET /P is the only way that a Batch file may behave like a "filter command": anycommand | aBatchFile.
by Aacini
03 Jan 2012 22:12
Forum: DOS Batch Forum
Topic: Piped input and output to a batch file
Replies: 18
Views: 30300

Re: Piped input and output to a batch file

The Batch file below take the prefix and suffix from parameters 1 and 2. If the %3 parameter is given, then it is the name of the input file to process; otherwise the piped input is processed. Anyway, the output is always sent to the standard output (the screen) that is the way that a "filter p...