KenCunningham
Technical User
Hi Folks,
I've recently been struggling with a problem whereby I receive a text file for processing, but have to remove any entries which fall below a certain monetary value before doing so. Basically, these are the text of reminder letters and are a standard 65 lines in length.
So far I have been able to identify the lines where these values occur (using grep -n) and have used head and tail to remove the lines above and below the first occurence and to write the remainder to a new file, but this then alters the number of lines within the file, so that the line numbers obtained by the first grep -n are no longer valid.
I may (well) be making this more difficult than it needs to be, but if anyone has any experience of removing documents from text files on the basis of value or other criteria, I'd be glad to hear how they managed it. If you require further information, please let me know. TIA.
I've recently been struggling with a problem whereby I receive a text file for processing, but have to remove any entries which fall below a certain monetary value before doing so. Basically, these are the text of reminder letters and are a standard 65 lines in length.
So far I have been able to identify the lines where these values occur (using grep -n) and have used head and tail to remove the lines above and below the first occurence and to write the remainder to a new file, but this then alters the number of lines within the file, so that the line numbers obtained by the first grep -n are no longer valid.
I may (well) be making this more difficult than it needs to be, but if anyone has any experience of removing documents from text files on the basis of value or other criteria, I'd be glad to hear how they managed it. If you require further information, please let me know. TIA.