Linked Questions
10 questions linked to/from removing lines between two patterns (not inclusive) with sed
-2 votes
1 answer
661 views
How can I delete all lines after a specific string from a number of files [duplicate]
I have n files, like: file1: Hannah Lars Test 123 1aaa 2eee file2: Mike Charly Stephanie Earl Test 123 3ccc 4ddd 5eee I want to remove all rows after "Test 123" from all n files. The ...
116 votes
8 answers
105k views
Using sed to delete all lines between two matching patterns
I have a file something like: # ID 1 blah blah blah blah $ description 1 blah blah # ID 2 blah $ description 2 blah blah blah blah How can I use a sed command to delete all lines between the # and $ ...
4 votes
3 answers
7k views
SED delete specific lines between two patterns?
I am trying to filter an *.ics file using sed. The *.ics file looks like this: [...] BEGIN:VEVENT UID:0xfoo SUMMARY:foo DTSTART:20131212T090000 DTEND:20131212T100000 SEQUENCE:0 DTSTAMP:...
2 votes
3 answers
5k views
sed delete lines between two patterns, without the second pattern, including the first pattern
my input file looks like this: [1234] text text text [3456] text text text [7458] text text text I want to delete all lines between the patterns, including FROM_HERE and excluding TO_HERE. sed '...
2 votes
1 answer
5k views
using sed to print between two patterns [duplicate]
So I've found a great deal on deleting the text between two patterns and on printing the text between two delimiters but I haven't found anything on printing the text between two patterns using bash ...
2 votes
5 answers
3k views
SED delete lines between two pattern matches
I am trying to replace lines between two pattern/string matches using SED see below. I need to delete lines below interface GigabitEthernet0/3 up to interface GigabitEthernet0/4, but leaving both ...
3 votes
3 answers
1k views
How to delete string between two HTML tags in one row using bash script
I have been working on some simple bash script recently, which parses specific data from webpages. I have used tr '\r\n' ' ' <file1.txt >file2.txt to make sure, all extracted data from page is ...
0 votes
2 answers
669 views
Remove lines are between two line numbers (or patterns) with sed [no duplicate]
I saw and read many topics about my problem, but they didn't help me. a close topic to my problem but it didn't help me: removing lines between two patterns (not inclusive) with sed Question: I have ...
0 votes
1 answer
174 views
Remove lines between matching PAIR of pattern
I have a text file containing some recurrent patterns, and I want to remove the lines between each matching pair of matching pattern. Problem: The last occurrence of "pattern line" is the "opening ...
-1 votes
3 answers
79 views
Delete text between 2 patterns using sed
I'm trying to remove some JavaScript between two patterns. The patterns are: /* React App Start */ And /* React App End */ I can successfully remove the JavaScript with the following: sed -i -e '/\/\...