in reply to Trying to get the complete opposite end results
It looks to me that you're pushing every line all the time. The opposite of that should be a trivial blank file.
I suggest using an if statement to decide which lines you wish to keep(print) or skip inside your while loop.
|
|---|