Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Can som1 help me. I have a txt file with a list of swf filenames in it seperated by a break.
example:somefile.swf
other.swf
3rd.swfwhat i'd like to do is to change the format so this:
&1=somefile.swf&2=other.swf&3=3rd.swf and so on until it runs out of names. it has to have no spaces. plz help

I can do that with a batch file, but I would need to know your exact OS. If you're under Windows, report its version, not simply "DOS".
-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br

It would be quite easy to do it with an assembler program, actually easier than in batch, perhaps Elmar (plop) can develop it...
-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br

Nevermind, I already developed a solution in C and sent to hyde via email. Here's the source code:
#include <stdio.h>
void main(void) {
int c,n;
n = 1;
c = '\n';while (c != EOF) {
if (c == '\n') {
while (c == '\n') c = getchar();
if (c == EOF) return;
printf("&%d=%c", n, c);
++n;
}
else {
putchar(c);
}
c = getchar();
}
}Forgive any bad syntaxes, I'm far from being as good in C as in batch =D
-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br______________________________________________________

I already sent you the solution in C, but it seems your email account is deactivated.
If you'd prefer the batch solution, I would need to know in which OS it should run.
-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br

Oh, sorry, you had reported your OS version at the time of my last post... I don't know what happened that I didn't process that information...
So, WinXP then. This should do it:
@echo off
if "%1"=="GoTo" goto %2
%comspec% /v:on /c %0 GoTo start
goto:eof
:start
echo XPYP[*'CC-\1P\QX,=P,APZ5O!PQ2O~5aaI~}Ksx> %temp%.\$.com
set N=1
type nul> OutFile
for /F "tokens=*" %%S in (InFile) do (
%temp%.\$.com &!N!=%%S>> OutFile
set /A N += 1
)
del %temp%.\$.comIt will get the information on InFile and build OutFile with the new format. If you want InFile and OutFile to be the same file (don't want to keep the original file), use something like this (using as example the filename MyFile.txt):
@echo off
if "%1"=="GoTo" goto %2
%comspec% /v:on /c %0 GoTo start
goto:eof
:start
echo XPYP[*'CC-\1P\QX,=P,APZ5O!PQ2O~5aaI~}Ksx> %temp%.\$.com
set N=1
type nul> %temp%.\$.dat
for /F "tokens=*" %%S in (MyFile.txt) do (
%temp%.\$.com &!N!=%%S>> %temp%.\$.dat
set /A N += 1
)
type %temp%.\$.dat > MyFile.txt
del %temp%.\$.dat
del %temp%.\$.comThat's it.
-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br___________________________________________________________________

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |