Re: Replace 1st Character On Each Line of a Text File?
- From: "Romual Piecyk" <RomualPiecyk@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 21 Apr 2005 11:17:02 -0700
Thanks to all for the replies. I went with what Corni Bogaarts suggested, and
created an output file that writes the manipulated text from the source text
file.
If anyone is interested in seeing my script, please email me at
romual.piecyk@xxxxxxxxx and I'll be happy to share.
"Corni Bogaarts" wrote:
> 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?
> >>
>
>
.
- 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
- Re: Replace 1st Character On Each Line of a Text File?
- From: Corné Bogaarts
- Replace 1st Character On Each Line of a Text File?
- Prev by Date: Re: Stop multiple services and restart server
- Next by Date: Re: Stop multiple services and restart server
- Previous by thread: Re: Replace 1st Character On Each Line of a Text File?
- Next by thread: what is the schema atttributes for computer object
- Index(es):
Relevant Pages
|