Quantcast
Viewing latest article 21
Browse Latest Browse All 102

Delete all lines from a line with certain string until another line with a diffrent string in a file

file.txt:

start some text works "HELLO" foo test  sum  otherendstart som "other" line with text 'also'  thing  fooend

and I want to delete the line in which "HELLO" is located and then delete all following lines until a line which has end written on it and nothing else!

I know this is a rather weird idea but I'm hoping either some basic bash command could do this or a function to which I pass the first string and the second and it deletes them and all in between!

The file should be looking like this at the end:

start som "other" line with text 'also'  thing  fooend

THANK YOU!


Viewing latest article 21
Browse Latest Browse All 102

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>