<?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: Scripting in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/4345002#M344082</link>
    <description>&amp;gt;Instead of reading in the entire file&lt;BR /&gt;&lt;BR /&gt;You have to read the file, nothing will seek for you.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;can I use the "---"s as a record separator?&lt;BR /&gt;&lt;BR /&gt;No, you must read every record and then recognize the "---" lines.&lt;BR /&gt;Using RS="-" in awk fails because you use "-" in your dates and text.&lt;BR /&gt;&lt;BR /&gt;You can check for lines with "---" in awk to do whatever you want.&lt;BR /&gt;&lt;BR /&gt;What are you really trying to do with your file?</description>
    <pubDate>Mon, 26 Jan 2009 23:32:34 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2009-01-26T23:32:34Z</dc:date>
    <item>
      <title>Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/4345001#M344081</link>
      <description>I am writing a script and I've hit the wall with this idea. Before I do, I just wanted to see if I can do this, if not, I have other ideas. I have a file that looks like this:&lt;BR /&gt;-----------------------------------------------------------&lt;BR /&gt;Audit mode        : Login-Success, Failure, Login-Failure&lt;BR /&gt;Group connections :&lt;BR /&gt;    Group         Owner       Date        Time  Type&lt;BR /&gt;    cweis         eacnobody   25-Jul-2008 23:19 Regular                        &lt;BR /&gt;    eiisgw        eacnobody   25-Jul-2008 23:19 Regular                        &lt;BR /&gt;Owner             : eacnobody     (USER   ) &lt;BR /&gt;Inactive days     : 0&lt;BR /&gt;Password interval : 0&lt;BR /&gt;Full name         : Richard El&lt;BR /&gt;Create time       : 25-Jul-2008 23:18&lt;BR /&gt;Update time       : 23-Feb-2008 03:05&lt;BR /&gt;Updated by        : 7972&lt;BR /&gt;&lt;BR /&gt;(localhost)&lt;BR /&gt;Data for USER '336'&lt;BR /&gt;----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Audit mode        : Login-Success, Failure, Login-Failure&lt;BR /&gt;Group connections :&lt;BR /&gt;    Group         Owner       Date        Time  Type&lt;BR /&gt;    cweis         eacnobody   25-Jul-2008 23:19 Regular                        &lt;BR /&gt;    eiisgw        eacnobody   25-Jul-2008 23:19 Regular                        &lt;BR /&gt;Owner             : eacnobody     (USER   ) &lt;BR /&gt;Inactive days     : 0&lt;BR /&gt;Password interval : 0&lt;BR /&gt;Full name         : Rich Oll&lt;BR /&gt;Create time       : 25-Jul-2008 23:18&lt;BR /&gt;Update time       : 23-Feb-2008 03:05&lt;BR /&gt;Updated by        : u672&lt;BR /&gt;&lt;BR /&gt;(localhost)&lt;BR /&gt;Data for USER 'u036e'&lt;BR /&gt;-----------------------------------------------------------&lt;BR /&gt;&lt;BR /&gt;Instead of reading in the entire file, can I use the ---'s as a record seperator? so from --- to --- is one file and so on?</description>
      <pubDate>Mon, 26 Jan 2009 20:51:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/4345001#M344081</guid>
      <dc:creator>Nobody's Hero</dc:creator>
      <dc:date>2009-01-26T20:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/4345002#M344082</link>
      <description>&amp;gt;Instead of reading in the entire file&lt;BR /&gt;&lt;BR /&gt;You have to read the file, nothing will seek for you.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;can I use the "---"s as a record separator?&lt;BR /&gt;&lt;BR /&gt;No, you must read every record and then recognize the "---" lines.&lt;BR /&gt;Using RS="-" in awk fails because you use "-" in your dates and text.&lt;BR /&gt;&lt;BR /&gt;You can check for lines with "---" in awk to do whatever you want.&lt;BR /&gt;&lt;BR /&gt;What are you really trying to do with your file?</description>
      <pubDate>Mon, 26 Jan 2009 23:32:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/4345002#M344082</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-01-26T23:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/4345003#M344083</link>
      <description>&amp;gt;&amp;gt; Instead of reading in the entire file, can I use the ---'s as a record seperator? so from --- to --- is one file and so on? &lt;BR /&gt;&lt;BR /&gt;May we assume you meant 'one line', not 'one file' ?&lt;BR /&gt;&lt;BR /&gt;Yes, tools like AWK and PERL are happy to accept alternative line terminators = "RECORD SEPERATORS".&lt;BR /&gt;&lt;BR /&gt;Witness, for the sample data presented:&lt;BR /&gt;&lt;BR /&gt;$ awk 'BEGIN {  } END { print NR }' tmp.txt&lt;BR /&gt;33&lt;BR /&gt;$ awk 'BEGIN { RS="\n--" } END { print NR }' tmp.txt&lt;BR /&gt;3&lt;BR /&gt;&lt;BR /&gt;Often there are minor glitches for the first and/or last seperator.&lt;BR /&gt;&lt;BR /&gt;Personally I often prefer the 'hunt and gather' technique. Hunt for recognizable handles and gather what goes with that.&lt;BR /&gt;I recently posted an example in:&lt;BR /&gt;&lt;A href="http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1306454" target="_blank"&gt;http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1306454&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Not knowing what problem you are really trying to solve, I'm guessing that in your case that could look like:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;$ awk '/^Fu/{name=$3 " " $4 " " $5} /^Update t/{date=$4} /^Da/{ print $4, date, name }' tmp.txt&lt;BR /&gt;'336' 23-Feb-2008 : Richard El&lt;BR /&gt;'u036e' 23-Feb-2008 : Rich Oll&lt;BR /&gt;&lt;BR /&gt;Or...&lt;BR /&gt;&lt;BR /&gt;$ awk 'BEGIN {FS=": "} /^Fu/{n=$2} /^Update t/{d=$2} /^Da/{ print $0, d, n;n=d="" }' tmp.txt&lt;BR /&gt;Data for USER '336' 23-Feb-2008 03:05 Richard El&lt;BR /&gt;Data for USER 'u036e' 23-Feb-2008 03:05 Rich Oll&lt;BR /&gt;&lt;BR /&gt;Enjoy!&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 27 Jan 2009 05:29:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/4345003#M344083</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2009-01-27T05:29:41Z</dc:date>
    </item>
  </channel>
</rss>

