473,609 Members | 2,273 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Deleting lines from an active file

1 New Member
I am trying to make an script that reads a line from a file and deletes it and continues like this until the last line. The catch is, that there is an application writing to this file so I can not just move it somewhere else and create a new file. I am trying to do this in windows (which makes it a bit more difficult for me).
If anybody has an idea of how I can do this, please tell me.
Feb 28 '07 #1
4 1119
KevinADC
4,059 Recognized Expert Specialist
what have you tried so far?
Feb 28 '07 #2
miller
1,089 Recognized Expert Top Contributor
I don't want to dissuade you from trying to make this happen ... wait, yes I do.

I don't believe that this is going to be possible. At least not easily. Having multiple processes modifying the same file is extremely messy. Unless you can ensure that each process will wait it's turn, you're likely to end up with corrupted data.

Anyway, if you succeed in getting this to work, I'd be curious to hear your approach.

Good luck,
- M
Feb 28 '07 #3
KevinADC
4,059 Recognized Expert Specialist
I'm sceptical too. Some versions of windows may not allow this anyway. If one process has a file open windows may not allow another process to access the file. This can result in a "permission/access denied" (or similar) error message returned by the OS.
Feb 28 '07 #4
vpmurdan
25 New Member
Hi.
Sorry, I have no answer (yet)?
but do u have any specific reason why you want to do this?

May be we can find another solution

Prakash
Mar 1 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
1654
by: John Aherne | last post by:
Being a bit of a newbie, I hope this question isn't too stupid. I have searched the archives and docs for any reports about files and csv messages and not found anything that mentions the problem I am having. I have happily been using the os.remove and file.close commands with a program that sends data to an ftp site. Now I am using the csv module to read some os files and extract some fields that I use to send messages to someone.
5
4015
by: Olaf Gschweng | last post by:
We're new into DB2 and have some problem with DB2 8.1 (?) on a Linux system. We load some big tables of a DB2 database from files every day. We do a "DELETE FROM table" for each table and then we load the data by something like that: LOAD FROM "/pathto/artikel.data" OF DEL MODIFIED BY DATESISO CHARDEL0xbf SAVECOUNT 50000 MESSAGES "/pathto/artikel.msg" INSERT INTO artikel;
6
4554
by: Martin Bischoff | last post by:
Hi, I'm creating temporary directories in my web app (e.g. ~/data/temp/temp123) to allow users to upload files. When I later delete these directories (from the code behind), the application restarts and all active sessions are terminated. This error is also described in detail here:...
5
2678
by: George | last post by:
VB.net 2003 standard, XP windows home edition. Installed first application OK today. When I removed the application via Control Panel, there were no problems and the app folders were deleted. But when I installed the app from a CD-ROM (Release folder is in D:), when I remove the app in Control Panel these problems occur: Control Panel does not delete the application folders. When I try to delete them I get message "Cannot delete file:...
2
1708
by: SiouxieQ | last post by:
Hi there, I'm using the code below to try to delete a name from a list of names in a file. Unfortunately it doesn't quite do what I want it to. Instead of looking for the name in the textbox and deleting that it is just deleting the first line of data in the file.
2
1834
by: fool | last post by:
Dear group, I am a beginner in php and I was little bit experience in C language. I want to read a file's content and delete the first line of the file and display those lines which has got deleted. The content of the external file , which is in .cvs format is: -------------------------------------------------------------------
13
2451
by: programming | last post by:
how do i delete from a text file 1 of the following lines: jon|scott adam|smith <--delete paul|clark say i would like to delete the middle line of this txt, in member.txt what php code or logic would help me accomplish this?
4
1521
by: blackice | last post by:
Hello All, i have a Perl Script that deleting Zones from named.conf file and here is the script #!/usr/bin/perl -w use strict; print "please enter the domain name: "; chomp (my $targetdomain = <STDIN>);
8
2208
by: Horacius ReX | last post by:
Hi, I need to write a program which reads an external text file. Each time it reads, then it needs to delete some lines, for instance from second line to 55th line. The file is really big, so what do you think is the fastest method to delete specific lines in a text file ? Thanks
0
8126
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
8065
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8563
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...
1
8210
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
5507
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
4013
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
2527
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1379
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.