<?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 Reorganise a log file using script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/reorganise-a-log-file-using-script/m-p/2961367#M118403</link>
    <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I was given a task to write a script to reorganise a record in multiple lines into a single line identified by the ID number for example '00719 00001'. The sample log are as below: &lt;BR /&gt;&lt;BR /&gt;00719 00001 maxis1d2 09/04/03 15:31:41  logger wap&lt;BR /&gt; logger: connection to system wap failed;&lt;BR /&gt; cu: Connect failed: SYSTEM NOT IN Systems FILE&lt;BR /&gt;00599 00001 maxis1d2 09/04/03 15:31:50  executive omcrkll6&lt;BR /&gt; exec: cannot execute /export/home/appadmin/bos/kevdir/a.out, errno = 2&lt;BR /&gt;07698 00001 maxis1d2 09/04/03 07:31:54  rtfwd&lt;BR /&gt; rtfwd: Error opening message log file, /bos/NOC/rts/lluminet/illuminet_log, errno 2&lt;BR /&gt;07724 07723 maxis1d2 09/04/03 15:32:00  alarmx&lt;BR /&gt; alarmx: Cannot send alarm to display&lt;BR /&gt; alarm display = SYS_DOWN, errno = 13, alr_errno = 72&lt;BR /&gt;&lt;BR /&gt;How can I write a Unix shell script to process such log? I am facing the problem because it does not consist a fix number of line for one record. It may come from 2 or 3 lines.&lt;BR /&gt;&lt;BR /&gt;Attached is the log file sample. Appreciate if you could show me how to overcome this problem.&lt;BR /&gt;&lt;BR /&gt;Thank you very much.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Melvin</description>
    <pubDate>Tue, 29 Apr 2003 07:07:08 GMT</pubDate>
    <dc:creator>Melvin Thong</dc:creator>
    <dc:date>2003-04-29T07:07:08Z</dc:date>
    <item>
      <title>Reorganise a log file using script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/reorganise-a-log-file-using-script/m-p/2961367#M118403</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I was given a task to write a script to reorganise a record in multiple lines into a single line identified by the ID number for example '00719 00001'. The sample log are as below: &lt;BR /&gt;&lt;BR /&gt;00719 00001 maxis1d2 09/04/03 15:31:41  logger wap&lt;BR /&gt; logger: connection to system wap failed;&lt;BR /&gt; cu: Connect failed: SYSTEM NOT IN Systems FILE&lt;BR /&gt;00599 00001 maxis1d2 09/04/03 15:31:50  executive omcrkll6&lt;BR /&gt; exec: cannot execute /export/home/appadmin/bos/kevdir/a.out, errno = 2&lt;BR /&gt;07698 00001 maxis1d2 09/04/03 07:31:54  rtfwd&lt;BR /&gt; rtfwd: Error opening message log file, /bos/NOC/rts/lluminet/illuminet_log, errno 2&lt;BR /&gt;07724 07723 maxis1d2 09/04/03 15:32:00  alarmx&lt;BR /&gt; alarmx: Cannot send alarm to display&lt;BR /&gt; alarm display = SYS_DOWN, errno = 13, alr_errno = 72&lt;BR /&gt;&lt;BR /&gt;How can I write a Unix shell script to process such log? I am facing the problem because it does not consist a fix number of line for one record. It may come from 2 or 3 lines.&lt;BR /&gt;&lt;BR /&gt;Attached is the log file sample. Appreciate if you could show me how to overcome this problem.&lt;BR /&gt;&lt;BR /&gt;Thank you very much.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Melvin</description>
      <pubDate>Tue, 29 Apr 2003 07:07:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/reorganise-a-log-file-using-script/m-p/2961367#M118403</guid>
      <dc:creator>Melvin Thong</dc:creator>
      <dc:date>2003-04-29T07:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: Reorganise a log file using script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/reorganise-a-log-file-using-script/m-p/2961368#M118404</link>
      <description>The sample log file as attached.</description>
      <pubDate>Tue, 29 Apr 2003 07:09:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/reorganise-a-log-file-using-script/m-p/2961368#M118404</guid>
      <dc:creator>Melvin Thong</dc:creator>
      <dc:date>2003-04-29T07:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: Reorganise a log file using script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/reorganise-a-log-file-using-script/m-p/2961369#M118405</link>
      <description>Hi Melvin,&lt;BR /&gt;&lt;BR /&gt;Something like:&lt;BR /&gt;&lt;BR /&gt;awk '/^[0-9]/&amp;amp;&amp;amp;NR&amp;gt;1{{print""}}{printf("%s",$0)}END{print""}' logfile&lt;BR /&gt;&lt;BR /&gt;should do it.&lt;BR /&gt;&lt;BR /&gt;rgds, Robin</description>
      <pubDate>Tue, 29 Apr 2003 07:41:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/reorganise-a-log-file-using-script/m-p/2961369#M118405</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2003-04-29T07:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: Reorganise a log file using script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/reorganise-a-log-file-using-script/m-p/2961370#M118406</link>
      <description>Yes, it works. You are superb Robin. Thanks a lot and it solves my problem.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Melvin</description>
      <pubDate>Tue, 29 Apr 2003 08:55:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/reorganise-a-log-file-using-script/m-p/2961370#M118406</guid>
      <dc:creator>Melvin Thong</dc:creator>
      <dc:date>2003-04-29T08:55:47Z</dc:date>
    </item>
  </channel>
</rss>

