Next Generation Emulation banner

Need a program to delete lines on ASCII files

819 Views 10 Replies 4 Participants Last post by  Demigod
I need a program, that i can set a word for him to search, and if found, delete a pre-defined numbers of lines, below or above.

Like search for the word "Telefone", if found, delete 7 lines above this word. And do this for the rest of the file.

Can it be done?
And yes, i know it sounds crazy...but look at my nick.... :thumb:
1 - 11 of 11 Posts
I'm... not really sure what you mean. For your Telefone example you mean delete 7 lines above the word for each instance of the word?

I could probably code something like that in C++ or Java, although I'm kind of busy studying for my math exam at the moment.
Let me make myself more clear.
Actually i want to delete 19 lines, and i want to delete the line that contains the word i searched and the other 18 above it, no matter what they are - size, type, entry...
Oh, if it isnt ask to much, that i could change the word to be search.
Yeah... it can be done... pretty much any halfway decent shell script or C/C++ coder should be able to crank this sort of thing out in minutes. However, I know of no COTS program that does this....
KillerShots said:
Yeah... it can be done... pretty much any halfway decent shell script or C/C++ coder should be able to crank this sort of thing out in minutes. However, I know of no COTS program that does this....
COTS program?
Mad said:
COTS program?
COTS = Commercial Off The Shelf - A common term for engineers. Sorry, I should have defined it.
Thx guys, now i know it can be done and im not that crazy ;)

Any coder reading this? Just a simple GUI, and the ability to change the search terms is enough for me.
Well, I made a program in Java that can do it. If you still need it then I can send it to you. I would have written it sooner but it's exam time here so I didn't have much time:S.
Yeah i really need it!
And if its not asking to much, could you make and option to export the search results?
It's no problem, just glad I could help:). The program I wrote should do what you're looking for. It allows you to open a file and view it, delete the lines as you described, save the search/delete results, and save the file. It has a GUI and allows you to enter the number of lines to delete as well as the keyword. It's written in Java so you need to have Java and JVM installed. I included a batch file to make it easy to run (just double-click the DeleteLine.bat file).
1 - 11 of 11 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top