How to delete lines?

Hello, Prompt.
There is a text file (*.txt), in it you need to delete the lines in which there is a combination, for example “0000”.


can it be done through this program?

Yes it can. I’d suggest the ReplaceAll Tool Function as a start.

Deleting lines that contain a particular string is not built into 010 Editor yet, but there is a script in the repository that should do want you want. To install click ‘Scripts > Script Repository’ and search for ‘DeleteLinesContaining.1sc’ and click the ‘Install’ button. Then the script should be available on the ‘Scripts > Text’ menu. In the future this functionality should be built directly into 010 Editor. Let us know if you have any questions. Cheers!

Graeme Sweet
SweetScape Software

1 Like

Works fine on small files 10Mb. But if the file is big 10-20Gb. Only 1 line is deleted, not all where there is a character “0000”.

Hello Alex

The script should work but it’s going to be very slow on a 10GB file. It also works from the bottom to the top of the file and there is no progress bar displayed. When the script is done you should see ‘Deleted XX Lines.’ in the status bar and can you confirm the script is finishing? If you have to do this on a number of files it would be possible to optimize the script so that it would run faster.

Graeme Sweet
SweetScape Software

Small bug. If you select the desired combination, copy and add to the script. That will remove 1 line.

If after copying, remove the selection from the combination and run the script. That will delete all lines.

If a selection is made in the file, the script is designed to scan only lines that the selection touches. If you want to make sure all lines are scanned then you should clear the selection before running the script.

Graeme Sweet
SweetScape Software

1 Like