Hello to everyone,
I'm pleased to say this is my first post on this forum
Guys, I'm trying to find a quick way to delete certain lines numbers from a text file. This text file is generated daily, has about 5000 lines every time and is then processed by another application.
However some lines are malformed and I get an error message from the aforementioned application telling me the line numbers that are erroneous.
So far I have been searching/deleting these lines manually but it's a pain in the butt to do this for 40-80 every time plus I have to do this at 5am in the morning so I really want to do it as fast as possible so I can get back to sleep!
So my question is how can I delete these particular line numbers with awk?
My idea is to create a new text file with the problematic line numbers like:
7
450
560
1002
3004
4000
and then pass this new file to awk to remove them from the other text file.
So far I've found this post here:
but it only works for 2 numbers. Any ideas how I can modify it to work with a random number of lines every time?
thanks,
Anestis
I'm pleased to say this is my first post on this forum
Guys, I'm trying to find a quick way to delete certain lines numbers from a text file. This text file is generated daily, has about 5000 lines every time and is then processed by another application.
However some lines are malformed and I get an error message from the aforementioned application telling me the line numbers that are erroneous.
So far I have been searching/deleting these lines manually but it's a pain in the butt to do this for 40-80 every time plus I have to do this at 5am in the morning so I really want to do it as fast as possible so I can get back to sleep!
So my question is how can I delete these particular line numbers with awk?
My idea is to create a new text file with the problematic line numbers like:
7
450
560
1002
3004
4000
and then pass this new file to awk to remove them from the other text file.
So far I've found this post here:
but it only works for 2 numbers. Any ideas how I can modify it to work with a random number of lines every time?
thanks,
Anestis