OTTOMH:<div><br></div><div>perl -n -e &#39;BEGIN {$state = 0} $state = 1 if ($state == 0 and /output start/); $state = 2 if ($state == 1 and /output end/)  ; print if ($state == 1)&#39; &lt; infile &gt; outfile<br><br></div>
<div>I&#39;ll bet there&#39;s a shorter AWK version though.</div><div><br></div><div>Sean</div><div><br><div class="gmail_quote">On Wed, Nov 10, 2010 at 10:51 AM, John Lange <span dir="ltr">&lt;<a href="mailto:john@johnlange.ca">john@johnlange.ca</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I have files with the following structure:<br>
<br>
garbage<br>
garbage<br>
garbage<br>
output start<br>
.. good data<br>
.. good data<br>
.. good data<br>
.. good data<br>
output end<br>
garbage<br>
garbage<br>
garbage<br>
<br>
How can I extract the good data from the file trimming the garbage<br>
from the beginning and end?<br>
<br>
The following works just fine but it&#39;s dirty because I don&#39;t like the<br>
fact that I have to pick an arbitrarily large number for the &quot;before&quot;<br>
and &quot;after&quot; values.<br>
<br>
grep -A 999999 &quot;output start&quot; &lt;infile&gt; | grep -B 999999 &quot;output end&quot; &gt; newfile<br>
<br>
Can anyone come up with something more elegant?<br>
<font color="#888888"><br>
--<br>
John Lange<br>
<a href="http://www.johnlange.ca" target="_blank">www.johnlange.ca</a><br>
_______________________________________________<br>
Roundtable mailing list<br>
<a href="mailto:Roundtable@muug.mb.ca">Roundtable@muug.mb.ca</a><br>
<a href="http://www.muug.mb.ca/mailman/listinfo/roundtable" target="_blank">http://www.muug.mb.ca/mailman/listinfo/roundtable</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Sean Walberg &lt;<a href="mailto:sean@ertw.com">sean@ertw.com</a>&gt;    <a href="http://ertw.com/">http://ertw.com/</a><br>
</div>