<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Read in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/read/m-p/3265908#M177789</link>
    <description>You could use the sed command.&lt;BR /&gt; &lt;BR /&gt;set -A data `sed -ne '1p;$p' &lt;YOURFILE&gt;&lt;/YOURFILE&gt;echo First line is ${data[0]}&lt;BR /&gt;echo Last  line is ${data[1]}&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills</description>
    <pubDate>Mon, 03 May 2004 13:19:51 GMT</pubDate>
    <dc:creator>Rodney Hills</dc:creator>
    <dc:date>2004-05-03T13:19:51Z</dc:date>
    <item>
      <title>Read</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read/m-p/3265905#M177786</link>
      <description>Hi&lt;BR /&gt;I need to read the first line of the file and the last line of the file.&lt;BR /&gt;can i use head or tail for doing that?&lt;BR /&gt;Thanks&lt;BR /&gt;</description>
      <pubDate>Mon, 03 May 2004 12:43:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read/m-p/3265905#M177786</guid>
      <dc:creator>Vanquish</dc:creator>
      <dc:date>2004-05-03T12:43:24Z</dc:date>
    </item>
    <item>
      <title>Re: Read</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read/m-p/3265906#M177787</link>
      <description>Certainly.&lt;BR /&gt;head -1 your_file &amp;gt; some_new_file&lt;BR /&gt;tail -1 your_file &amp;gt;&amp;gt; some_new_file&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;dl</description>
      <pubDate>Mon, 03 May 2004 12:50:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read/m-p/3265906#M177787</guid>
      <dc:creator>Dave La Mar</dc:creator>
      <dc:date>2004-05-03T12:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: Read</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read/m-p/3265907#M177788</link>
      <description>The tail command can be used for both but if all you want to do is read the 1st line of a file, the line command is perfect&lt;BR /&gt;&lt;BR /&gt;INFILE=myfile&lt;BR /&gt;FIRST=$(line &amp;lt; ${INFILE})&lt;BR /&gt;LAST=$(tail -n -1 ${INFILE})&lt;BR /&gt;&lt;BR /&gt;echo "First: ${FIRST}"&lt;BR /&gt;echo "Last : ${LAST}"&lt;BR /&gt;</description>
      <pubDate>Mon, 03 May 2004 12:56:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read/m-p/3265907#M177788</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-05-03T12:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: Read</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read/m-p/3265908#M177789</link>
      <description>You could use the sed command.&lt;BR /&gt; &lt;BR /&gt;set -A data `sed -ne '1p;$p' &lt;YOURFILE&gt;&lt;/YOURFILE&gt;echo First line is ${data[0]}&lt;BR /&gt;echo Last  line is ${data[1]}&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Mon, 03 May 2004 13:19:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read/m-p/3265908#M177789</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2004-05-03T13:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: Read</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read/m-p/3265909#M177790</link>
      <description>Oh, be sure to put the following in the script before the "sed"-&lt;BR /&gt; &lt;BR /&gt;IFS="^J"&lt;BR /&gt; &lt;BR /&gt;^J is what you get when you press control-v followed by CR.&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Mon, 03 May 2004 13:24:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read/m-p/3265909#M177790</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2004-05-03T13:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: Read</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read/m-p/3265910#M177791</link>
      <description>sed -n '1p;$p' input-file-name</description>
      <pubDate>Mon, 03 May 2004 13:48:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read/m-p/3265910#M177791</guid>
      <dc:creator>Thom Cornwell</dc:creator>
      <dc:date>2004-05-03T13:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: Read</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read/m-p/3265911#M177792</link>
      <description>&lt;BR /&gt;I like the sed solutions.&lt;BR /&gt;&lt;BR /&gt;Here is a simple awk solution in case you need to do more then just print:&lt;BR /&gt;&lt;BR /&gt;awk 'BEGIN {getline; print} END {print x} {x=$0}' &amp;lt; your-file&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;And a silly solution in perl:&lt;BR /&gt;&lt;BR /&gt;$ perl -e 'while (&amp;lt;&amp;gt;) {print unless ($x); $x=$_} print $x' &amp;lt; your-file&lt;BR /&gt;&lt;BR /&gt;- loop through the input, print the line uless you have remembered a line. This takes care of the first line. Remembering lines in $x. At the end, print the last line remembered... being the last line :-).&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 04 May 2004 00:07:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read/m-p/3265911#M177792</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-05-04T00:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Read</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/read/m-p/3265912#M177793</link>
      <description>echo "`head -1 yourfile` "\\n" `tail -1 yourfile` " &lt;BR /&gt;&lt;BR /&gt;regds,&lt;BR /&gt;&lt;BR /&gt;Kaps&lt;BR /&gt;</description>
      <pubDate>Tue, 04 May 2004 04:12:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/read/m-p/3265912#M177793</guid>
      <dc:creator>KapilRaj</dc:creator>
      <dc:date>2004-05-04T04:12:58Z</dc:date>
    </item>
  </channel>
</rss>

