The syntax for this is:
sed -n '/Regex1/,/Regex2/p'
But this includes the lines where Regex1 and Regex2 are found, how can I exclude them?
For example:
abcd-Regex1
BlaBlaBla
abcd-Regex2
Then I only want: BlaBlaBla
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can do this with a simple state machine in
awk:It basically uses an echo flag
e, with the commands below executed in sequence for each line:/Regex2/{e=0}turns echo off when terminating line found.{if(e){print}}prints line if echo is on./Regex1/{e=1}turns echo on when initialising line found.If you must use only
sed, there is a way you can do it by passing it through anothersedto delete the start and end lines: