Re: Replace 1st Character On Each Line of a Text File?
- From: Corné Bogaarts <does.not.exist@xxxxxxxxxxxxx>
- Date: Thu, 21 Apr 2005 17:52:36 +0200
You don't have to use an Array. Simply open 2 files, the source file
ForReading and the target file ForWriting. Make a loop that reads each
line from the source, manipulates the first character and directly
writes it to the target file.
When the loop is finished, close both files. Maybe you need to remove
the original source file and rename the targetfile to the same name as
the original source file. (Depends on what you exactly want to
achieve.)
On Thu, 21 Apr 2005 07:45:03 -0700, "Romual Piecyk"
<RomualPiecyk@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>Thanks for the reply. I am actually very familiar with reading and writing
>text files using the FileSystem object. What I can seem to find info on is
>how to do exactly what you described - read a line, make a change to it, then
>rewrite over it.
>
>I thought about taking the file and putting each line into an array, then
>try to rewrite each line with the new text to a new text file, but the array
>would have to be about 600,000 objects large, and I don't know if an array
>can be that big.
>
>
>"WM" wrote:
>
>> Search for FSO - the FileSystem Object. You can easily open a file,
>> read it line by line, and write the value of the line back with
>> changes. You should be able to google up some good examples.
>> 4/20/2005 9:03:02 PM
>> Romual Piecyk <RomualPiecyk@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
>> message
>> <193BB6D1-8684-4F69-9C25-0399E405C816@xxxxxxxxxxxxx>
>>
>> > I need a script that will open and read a text file, and replace
>> the first
>> > character of every line with an X, or whatever other character I
>> choose. Does
>> > anyone have any ideas that can start me in the write direction?
>>
.
- Follow-Ups:
- Re: Replace 1st Character On Each Line of a Text File?
- From: Romual Piecyk
- Re: Replace 1st Character On Each Line of a Text File?
- References:
- Replace 1st Character On Each Line of a Text File?
- From: Romual Piecyk
- Re: Replace 1st Character On Each Line of a Text File?
- From: Romual Piecyk
- Replace 1st Character On Each Line of a Text File?
- Prev by Date: Re: Modifying Logon User Name
- Next by Date: Re: Exporting User Information to Excel
- Previous by thread: Re: Replace 1st Character On Each Line of a Text File?
- Next by thread: Re: Replace 1st Character On Each Line of a Text File?
- Index(es):
Relevant Pages
|