I have a bash script that extracts headers from the MIME Source of an email.  The idea is that I only want to capture the headers of the message nothing else.  It's not quite working right though. I want it to do the following: 1) Start at the top of the email.2) Isolate just the part that starts with From (my particular upstream mail server ALWAYS starts the header with a line containing this).3) Capture all lines below it UNTIL the first line break.4) Don't bother capture stuff from the remainder of the email.I thought I could do it with this sed pattern: sed -n /From/,/^$/pUnfortunately it triggers on other instances of From.  For example, if someone forwardes a message and there is content like: ---------- Forwarded message ----------From: Newsletter <newsletter@foo.com>Date: Wed, Jan 28, 2015 at 9:16 PMSubject: BlargenflugentTo: examplerecipient@domain.comHow can I have sed ignore content after the first line break? 
How do I have sed only perform actions on the first match?
bash;shell script;sed
sed '/From/,$!d;/./!q' <infile...the above expression instructs sed to delete from output all lines which do !not fall within the range of /From/ through the $last line. Each time it deletes a line it stops reading its script and starts over with the next input line from the top - and so it doesn't read the next command. So the /./!quit command means sed only quits input on the first line following the first occurrence of From in its input which does !not contain at least a single .character.