Hi!

Here's what I need to do:

I have a text file of 141 lines which contains data considering
web-application. In line 5 of the txt-file, the username is introduced.
Now I would need a script, which would ask me the username, and then
the script would modify the Username section, in the line 5 of the
text-file.

So basicly I would need a "Username" -variable. The value of "Username"
would be entered by a user, and then the script should input the value
to the text file.

Do you have any ideas which would be an easy way to accomplish this? It
seems that FileSystemObject cannot modify text-files, is that right?

Thanks in advance,

Henri

Re: Editing txt file. by Jimmy

Jimmy
Wed May 10 10:06:01 CDT 2006

yes... the filesystem object.
you would read the contents of the file line by line, and at the same time
write it to a new file, changing the lines that you wish to change. when
youre done you would delete the old file


<henri.nevalainen@gmail.com> wrote in message
news:1147267060.169355.271640@y43g2000cwc.googlegroups.com...
> Hi!
>
> Here's what I need to do:
>
> I have a text file of 141 lines which contains data considering
> web-application. In line 5 of the txt-file, the username is introduced.
> Now I would need a script, which would ask me the username, and then
> the script would modify the Username section, in the line 5 of the
> text-file.
>
> So basicly I would need a "Username" -variable. The value of "Username"
> would be entered by a user, and then the script should input the value
> to the text file.
>
> Do you have any ideas which would be an easy way to accomplish this? It
> seems that FileSystemObject cannot modify text-files, is that right?
>
> Thanks in advance,
>
> Henri
>



Re: Editing txt file. by mr_unreliable

mr_unreliable
Wed May 10 12:07:45 CDT 2006

bonjour henri,

Yes, fso can not "modify" a file, but it can read it and
re-write it.

In addition to the above, if the file is not too large,
you could read it in "all-at-once" with readall, then
change the user name with the replace function, then
re-write the (entire) file with the write method.

au revoir, jw

henri.nevalainen@gmail.com wrote:
> Hi!
>
> Here's what I need to do:
>
> I have a text file of 141 lines which contains data considering
> web-application. In line 5 of the txt-file, the username is introduced.
> Now I would need a script, which would ask me the username, and then
> the script would modify the Username section, in the line 5 of the
> text-file.
>
> So basicly I would need a "Username" -variable. The value of "Username"
> would be entered by a user, and then the script should input the value
> to the text file.
>
> Do you have any ideas which would be an easy way to accomplish this? It
> seems that FileSystemObject cannot modify text-files, is that right?
>
> Thanks in advance,
>
> Henri
>