Deleting lines from an active file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rodrigopr
    New Member
    • Feb 2007
    • 1

    Deleting lines from an active file

    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.
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    what have you tried so far?

    Comment

    • miller
      Recognized Expert Top Contributor
      • Oct 2006
      • 1086

      #3
      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

      Comment

      • KevinADC
        Recognized Expert Specialist
        • Jan 2007
        • 4092

        #4
        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.

        Comment

        • vpmurdan
          New Member
          • Feb 2007
          • 25

          #5
          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

          Comment

          Working...