Jump to content

MS-DOS: Loop through each text line and delete it after

- - - - -

  • Please log in to reply
3 replies to this topic

#1
Sharp-Shooter

Sharp-Shooter

    Newbie

  • Members
  • Pip
  • 2 posts
Hello everyone.
I have a MS-DOS batch script that executes a custom command for each line in a specific text file. And I want it to delete each line after executing the command so that the next time i open the batch i can resume it without starting all over and executing the loop through the same lines. Got it ?

Thank you very much :)

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Why not just delete the file when done?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Sharp-Shooter

Sharp-Shooter

    Newbie

  • Members
  • Pip
  • 2 posts
Actually the file have more than 13000 lines = 13000 loops and there is a wait time between each loop executed. Its a "few" days. Thats why I need to know how to delete each line after, because the loop for each line may only be done once. The simple MS-DOS command to delete each line after its all I need.

Thanks

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Calling it a "simple" MS-DOS command assumes the command exists. Again, why do you need to delete them one at a time? I'm questioning your assumptions on purpose, because I suspect there is a different way to think about your problem that will help. You should be able to process 13000 lines in a few minutes, not a few days.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users