473,591 Members | 2,871 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FSO delete the very last character in tgext file

With ASP, I am generating a huge CSV file. It is to large to open in
notepad.

Can I use the Filesystem Scripting Object to read the very last line of the
file and delete the very last character?

I am hoping the DSO will not have to read thru the whole file. it is
probably way to big.

Thank youi very much
Jul 19 '05 #1
6 2266
*Carol* wrote:
With ASP, I am generating a huge CSV file. It is to large to open in
notepad.

Can I use the Filesystem Scripting Object to read the very last line
of the file and delete the very last character?

I am hoping the DSO will not have to read thru the whole file. it is
probably way to big.


You could use FSO to:
Create a new file ready for writing to.
Open the original file for reading.
Repeating until the end of the original file {
Read a single line at a time.
If the line is the last line in the file perform the modification
to that line that you wanted.
Write the line to the new file.
}
Close the new file.
On successful completion delete the original file.
Move the new file to a original files location.

Reading a single line at a time from a very large file does not require
significant resources to execute, whereas using the ReadAll() method
could bring a system to its knees in such a case.
--
Andrew Urquhart
- FAQ: www.aspfaq.com
- Archive: www.tinyurl.com/38kzx (Google Groups)
- Contact me: http://andrewu.co.uk/contact/
- Apologies for the wrong timestamp on my post - blame my ISP
Jul 19 '05 #2
"Carol" <kg**@helkusa.c om> wrote in message
news:Ws******** ************@co mcast.com...
With ASP, I am generating a huge CSV file. It is to large to open in
notepad.
That's big!
Can I use the Filesystem Scripting Object to read the very last line of
the file and delete the very last character?


You'd be far better off changing the routine that writes it to suppress
this last character, whatever that might be.

HTH,
Phill W.
Jul 19 '05 #3
good to know . thanks you very much. One line at a time. i think I could
handle that since it is written one line at a time in about 15 mintes.

"Andrew Urquhart" <us************ **************@ spam.invalid> wrote in
message news:xu******** ******@newsfe5-gui.ntli.net...
*Carol* wrote:
With ASP, I am generating a huge CSV file. It is to large to open in
notepad.

Can I use the Filesystem Scripting Object to read the very last line
of the file and delete the very last character?

I am hoping the DSO will not have to read thru the whole file. it is
probably way to big.


You could use FSO to:
Create a new file ready for writing to.
Open the original file for reading.
Repeating until the end of the original file {
Read a single line at a time.
If the line is the last line in the file perform the modification
to that line that you wanted.
Write the line to the new file.
}
Close the new file.
On successful completion delete the original file.
Move the new file to a original files location.

Reading a single line at a time from a very large file does not require
significant resources to execute, whereas using the ReadAll() method
could bring a system to its knees in such a case.
--
Andrew Urquhart
- FAQ: www.aspfaq.com
- Archive: www.tinyurl.com/38kzx (Google Groups)
- Contact me: http://andrewu.co.uk/contact/
- Apologies for the wrong timestamp on my post - blame my ISP

Jul 19 '05 #4
If i read one line at a time, how will I know when I hit the last line?

"Andrew Urquhart" <us************ **************@ spam.invalid> wrote in
message news:xu******** ******@newsfe5-gui.ntli.net...
*Carol* wrote:
With ASP, I am generating a huge CSV file. It is to large to open in
notepad.

Can I use the Filesystem Scripting Object to read the very last line
of the file and delete the very last character?

I am hoping the DSO will not have to read thru the whole file. it is
probably way to big.


You could use FSO to:
Create a new file ready for writing to.
Open the original file for reading.
Repeating until the end of the original file {
Read a single line at a time.
If the line is the last line in the file perform the modification
to that line that you wanted.
Write the line to the new file.
}
Close the new file.
On successful completion delete the original file.
Move the new file to a original files location.

Reading a single line at a time from a very large file does not require
significant resources to execute, whereas using the ReadAll() method
could bring a system to its knees in such a case.
--
Andrew Urquhart
- FAQ: www.aspfaq.com
- Archive: www.tinyurl.com/38kzx (Google Groups)
- Contact me: http://andrewu.co.uk/contact/
- Apologies for the wrong timestamp on my post - blame my ISP

Jul 19 '05 #5
*Carol* wrote:
If i read one line at a time, how will I know when I hit the last
line?


http://msdn.microsoft.com/library/en...ndofstream.asp
--
Andrew Urquhart
- Contact me: http://andrewu.co.uk/contact/
- 'Staccato signals of constant information
A loose affiliation of millionaires and billionaires' - Paul Simon
Jul 19 '05 #6
thanks

"Andrew Urquhart" <us************ **************@ spam.invalid> wrote in
message news:t6******** ******@newsfe5-gui.ntli.net...
*Carol* wrote:
If i read one line at a time, how will I know when I hit the last
line?

http://msdn.microsoft.com/library/en...ndofstream.asp --
Andrew Urquhart
- Contact me: http://andrewu.co.uk/contact/
- 'Staccato signals of constant information
A loose affiliation of millionaires and billionaires' - Paul Simon

Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
13343
by: Srinivasa T.N. | last post by:
Hi, I want to delete the first 3 lines and last 3 lines of a file. How can I do it? I want to repeat on multiple files.. TIA Regards, Seenu.
1
4443
by: Someonekicked | last post by:
I have a binary file, and I need to delete a specific number of characters in it. The file contains records, each record has a specific length. So the way I wanna handle deleting is that I will overwrite the record I want to delete with the last record in the file, then actually delete that last record in the file. the problem Im having is how to delete that last record in the file. Suppose each record is of length 43, then I have...
39
16772
by: Timex | last post by:
I want to delete all comments in .c file. Size of .c file is very big. Any good idea to do this? Please show me example code.
26
21660
by: S!mb | last post by:
Hi all, I'm currently developping a tool to convert texts files between linux, windows and mac. the end of a line is coded by 2 characters in windows, and only one in unix & mac. So I have to delete a character at each end of a line. car = fgetc(myFile); while (car != EOF) {
3
4007
by: ozbear | last post by:
The title says it all. Since a Richedit control doesn't understand a backspace character ('\b', or 0x08) when I receive one I need to programmatically delete the last character from the Richedit control. This is a WinForms application, not a webform. I have tried... re.SelectionLength = 1; re.SelectionStart = re.Textlength-1; re.SelectionText = ""; // empty string
4
10615
by: Ignoramus6539 | last post by:
There were some strange requests to my server asking for config.php file (which I do not have in the requested location). I did some investigation. Seems to be a virus written in perl, exploiting a vulnerability in php code. The requests are like this 216.120.231.252 - - "GET /algebra/about/history/config.php?returnpath=http://domates.1gig.biz/spread.txt? HTTP/1.1" 404 561 "-" "libwww-perl/5.805"
5
15592
by: dudeja.rajat | last post by:
Sorry : Earlier mail had a typo in Subject line which might look in-appropriate to my friends Hi, I've a list some of whose elements with character \. I want to delete this last character from the elements that have this character set at their end,
0
1131
by: Fredrik Lundh | last post by:
dudeja.rajat@gmail.com wrote: explicitly comparing against true is bad style; better write that as if item.endswith('\\'): item.endswith("\\") works just fine:
0
1702
by: norseman | last post by:
dudeja.rajat@gmail.com wrote: ============================== depending on OS and other factors, the DirList may be more like: ABDIR\ 41 42 44 49 52 5C 0A nextDir If so endswith needs to look for \\ and \n or just
0
7934
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8236
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8362
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7992
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6639
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5400
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3850
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1465
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1199
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.