I'm facing an issue with mails. I need to get all messages between 2 people:
somebody1@domain.com and person@domain.com.
The file:
From: somebody1@domain.com
to: person@domain.com
<body of the message1>
From: somebody2@domain.com
to: person@domain.com
<body of the message1>
From: somebody1@domain.com
to: person@domain.com
<body of the message1>
From: somebody3@domain.com
to: person@domain.com
<body of the message1>
From: somebody5@domain.com
to: person@domain.com
<body of the message1>
I tried to use the following sed:
sed -n "/From: [Ss]omebody1/,/From: /p" inputfile > test.txt
As a result I got all mails from somebody1 to test.txt file.
Question is: What should be the structre of sed to get only mails between somebody1 and person?