tybalt89, how do I modify to remove the previous line word if doesn't include (d,_,-) for example if only says Text.
sample-text file Text-1
matching the 1st line
matching the last line
text
text_1
sample-text file text-2
matching the 1st line
matching the last line
text_1
text-2
text
sample-text file text
matching the 1st line
matching the last line
I need to remove the following ( text ) too-
.....................
text_1
text-2
text
sample-text file text
matching the 1st line
matching the last line