<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40" xmlns:ns0="urn:schemas-microsoft-com:office:smarttags">
<head>
<!-- Template generated by Exclaimer Mail Disclaimers on 11:10:17 Wednesday, 28 March 2012 -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">P.e033d674-3a3b-4ac4-8167-2659823254ee {
        MARGIN: 0cm 0cm 0pt
}
LI.e033d674-3a3b-4ac4-8167-2659823254ee {
        MARGIN: 0cm 0cm 0pt
}
DIV.e033d674-3a3b-4ac4-8167-2659823254ee {
        MARGIN: 0cm 0cm 0pt
}
TABLE.e033d674-3a3b-4ac4-8167-2659823254eeTable {
        MARGIN: 0cm 0cm 0pt
}
DIV.Section1 {
        page: Section1
}
</style>
<meta name="Generator" content="Microsoft Word 11 (filtered medium)">
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang="EN-US" link="blue" vlink="purple">
<p class="e033d674-3a3b-4ac4-8167-2659823254ee"></p>
<div class="Section1">
<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size:10.0pt;
font-family:Arial">We have variable length text files being received in which the “header” line we use in automated processing is the last line of the file rather than the first
line.<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size:10.0pt;
font-family:Arial"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size:10.0pt;
font-family:Arial">What is the best way to move that last line of a text file to be the first line?<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size:10.0pt;
font-family:Arial"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size:10.0pt;
font-family:Arial">Please answer the question as asked and don’t suggest making the file be in the correct order when we receive it or changing the automated processing to read
the last line first. Assume those aren’t options.<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size:10.0pt;
font-family:Arial"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size:10.0pt;
font-family:Arial">What I came up with was to do tail -1 >newfile and head -<number of lines – 1> but was thinking there ought to be a better way.<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size:10.0pt;
font-family:Arial"><o:p> </o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Arial"><span style="font-size:10.0pt;
font-family:Arial">I see sed can deal with last line, first line and insertion but the examples I’m finding address either/or not moving last line to first line.<o:p></o:p></span></font></p>
</div>
<p></p>
<p class="e033d674-3a3b-4ac4-8167-2659823254ee"> </p>
<p class="e033d674-3a3b-4ac4-8167-2659823254ee"> </p>
<p class="e033d674-3a3b-4ac4-8167-2659823254ee"></p>
<p class="e033d674-3a3b-4ac4-8167-2659823254ee"><font face="Arial"><font color="fuchsia"><font style="FONT-FAMILY: Arial; FONT-SIZE: 10pt" size="2"></font></font></font> </p>
<p class="e033d674-3a3b-4ac4-8167-2659823254ee"> </p>
<p class="e033d674-3a3b-4ac4-8167-2659823254ee"><font face="Arial"><font color="fuchsia"><font style="FONT-FAMILY: Arial; FONT-SIZE: 10pt" size="2">Athena<font size="1">®</font>, Created for the Cause</font><font size="1">™
</font></font></font></p>
<p class="e033d674-3a3b-4ac4-8167-2659823254ee"><font size="2" face="Arial">Making a Difference in the Fight Against Breast Cancer</font></p>
<p class="e033d674-3a3b-4ac4-8167-2659823254ee"><font size="2" face="Arial"></font> </p>
<p class="e033d674-3a3b-4ac4-8167-2659823254ee"><font size="2" face="Arial"></font> </p>
<p class="e033d674-3a3b-4ac4-8167-2659823254ee"><font face="Arial"><font size="2"><strong>How and Why I Should Support Bottled Water!<br>
</strong>Do not relinquish your right to choose bottled water as a healthy alternative to beverages that contain sugar, calories, etc. Your support of bottled water will make a difference! Your signatures count! Go to
<a href="http://www.bottledwatermatters.org/luv-bottledwater-iframe/dswaters">http://www.bottledwatermatters.org/luv-bottledwater-iframe/dswaters</a> and sign a petition to support your right to always choose bottled water. Help fight federal and state issues,
such as bottle deposits (or taxes) and organizations that want to ban the sale of bottled water. Support community curbside recycling programs. Support bottled water as a healthy way to maintain proper hydration. Our goal is 50,000 signatures. Share this petition
with your friends and family today!</font></font></p>
<p class="e033d674-3a3b-4ac4-8167-2659823254ee"><font size="2" face="Arial"></font> </p>
<p class="e033d674-3a3b-4ac4-8167-2659823254ee"><span style="FONT-FAMILY: Arial; FONT-SIZE: 10pt">---------------------------------<br>
CONFIDENTIALITY NOTICE: This e-mail may contain privileged or confidential information and is for the sole use of the intended recipient(s). If you are not the intended recipient, any disclosure, copying, distribution, or use of the contents of this information
is prohibited and may be unlawful. If you have received this electronic transmission in error, please reply immediately to the sender that you have received the message in error, and delete it. Thank you.<br>
----------------------------------</span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 9pt"><o:p></o:p></span></p>
<p> </p>
<p></p>
<p></p>
</body>
</html>