<?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 Regarding shell script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004609#M773418</link>
    <description>I have a  data file of the below format with a lot of records.  It has a tab delimiter in it.&lt;BR /&gt;I want to extract only the toos_details records which has owner as localexchange and outage as CAD and write it into a new file. How do i do it?  Do i need to write a C program or i can achieve through shell script&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;toos_details&lt;BR /&gt;        rpt_clli        ARTNVACK04T&lt;BR /&gt;        tfn     22&lt;BR /&gt;        trfus   IT&lt;BR /&gt;        trfcl   PH&lt;BR /&gt;        ofcls   34&lt;BR /&gt;        ttm     CPR&lt;BR /&gt;        cllia   ARTNVACK04T&lt;BR /&gt;        dpl     77&lt;BR /&gt;        clliz   SGINTXAA02T&lt;BR /&gt;        outage  CAD&lt;BR /&gt;        ins     Y&lt;BR /&gt;        oos_ts  Sep 22 11:24:10 2003&lt;BR /&gt;        topas_ts        Sep 21 03:50:28 2006&lt;BR /&gt;        tgak    51303&lt;BR /&gt;        btfn    0001&lt;BR /&gt;        num_trk 72&lt;BR /&gt;        num_toos        72&lt;BR /&gt;        gap     022&lt;BR /&gt;        owner   localexchange&lt;BR /&gt;&lt;BR /&gt;toos_details&lt;BR /&gt;        rpt_clli        ARTNVACK04T&lt;BR /&gt;        tfn     8001&lt;BR /&gt;        trfus   AD&lt;BR /&gt;        trfcl   DF&lt;BR /&gt;        ofcls   35&lt;BR /&gt;        ttm     ACDCG0&lt;BR /&gt;        cllia   ARTNVACK04T&lt;BR /&gt;        dpl     ZZ&lt;BR /&gt;        clliz   TYCRVAAMN01&lt;BR /&gt;        outage  MTC&lt;BR /&gt;        ins     Y&lt;BR /&gt;        oos_ts  Jan 14 15:01:06 2006&lt;BR /&gt;        topas_ts        Sep 21 03:50:28 2006&lt;BR /&gt;        tgak    8985&lt;BR /&gt;        btfn    8001&lt;BR /&gt;        num_trk 1&lt;BR /&gt;        num_toos        1&lt;BR /&gt;        gap     070&lt;BR /&gt;        owner   nodal&lt;BR /&gt;</description>
    <pubDate>Thu, 21 Sep 2006 06:52:41 GMT</pubDate>
    <dc:creator>vind123</dc:creator>
    <dc:date>2006-09-21T06:52:41Z</dc:date>
    <item>
      <title>Regarding shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004609#M773418</link>
      <description>I have a  data file of the below format with a lot of records.  It has a tab delimiter in it.&lt;BR /&gt;I want to extract only the toos_details records which has owner as localexchange and outage as CAD and write it into a new file. How do i do it?  Do i need to write a C program or i can achieve through shell script&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;toos_details&lt;BR /&gt;        rpt_clli        ARTNVACK04T&lt;BR /&gt;        tfn     22&lt;BR /&gt;        trfus   IT&lt;BR /&gt;        trfcl   PH&lt;BR /&gt;        ofcls   34&lt;BR /&gt;        ttm     CPR&lt;BR /&gt;        cllia   ARTNVACK04T&lt;BR /&gt;        dpl     77&lt;BR /&gt;        clliz   SGINTXAA02T&lt;BR /&gt;        outage  CAD&lt;BR /&gt;        ins     Y&lt;BR /&gt;        oos_ts  Sep 22 11:24:10 2003&lt;BR /&gt;        topas_ts        Sep 21 03:50:28 2006&lt;BR /&gt;        tgak    51303&lt;BR /&gt;        btfn    0001&lt;BR /&gt;        num_trk 72&lt;BR /&gt;        num_toos        72&lt;BR /&gt;        gap     022&lt;BR /&gt;        owner   localexchange&lt;BR /&gt;&lt;BR /&gt;toos_details&lt;BR /&gt;        rpt_clli        ARTNVACK04T&lt;BR /&gt;        tfn     8001&lt;BR /&gt;        trfus   AD&lt;BR /&gt;        trfcl   DF&lt;BR /&gt;        ofcls   35&lt;BR /&gt;        ttm     ACDCG0&lt;BR /&gt;        cllia   ARTNVACK04T&lt;BR /&gt;        dpl     ZZ&lt;BR /&gt;        clliz   TYCRVAAMN01&lt;BR /&gt;        outage  MTC&lt;BR /&gt;        ins     Y&lt;BR /&gt;        oos_ts  Jan 14 15:01:06 2006&lt;BR /&gt;        topas_ts        Sep 21 03:50:28 2006&lt;BR /&gt;        tgak    8985&lt;BR /&gt;        btfn    8001&lt;BR /&gt;        num_trk 1&lt;BR /&gt;        num_toos        1&lt;BR /&gt;        gap     070&lt;BR /&gt;        owner   nodal&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Sep 2006 06:52:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004609#M773418</guid>
      <dc:creator>vind123</dc:creator>
      <dc:date>2006-09-21T06:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004610#M773419</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;# cat ./extract&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;local $/ = undef;&lt;BR /&gt;@sections = split /toos_details/, &amp;lt;&amp;gt;;&lt;BR /&gt;for $_ (@sections) {&lt;BR /&gt;    print if /owner\s+localexchange/ and /outage\s+CAD/;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;...run as:&lt;BR /&gt;&lt;BR /&gt;# ./extract file&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 21 Sep 2006 07:09:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004610#M773419</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-21T07:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004611#M773420</link>
      <description>&lt;!--!*#--&gt;Hi (again):&lt;BR /&gt;&lt;BR /&gt;This is better, since it retains the first section header --- the "toos_details":&lt;BR /&gt;&lt;BR /&gt;# cat ./extract&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;local $/ = undef;&lt;BR /&gt;@sections = split( /(?=(toos_details))/, &amp;lt;&amp;gt; );&lt;BR /&gt;for $_ (@sections) {&lt;BR /&gt;    print if /owner\s+localexchange/ and /outage\s+CAD/;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;...run as:&lt;BR /&gt;&lt;BR /&gt;# ./extract file&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Sep 2006 07:38:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004611#M773420</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-21T07:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004612#M773421</link>
      <description>1. I tried the script and i am getting some errors&lt;BR /&gt;&lt;BR /&gt;&amp;gt;cat extract&lt;BR /&gt;#!/usr/contrib/bin/perl&lt;BR /&gt;local $/ = undef;&lt;BR /&gt;sections = split /toos_details/, &amp;lt;&amp;gt;;&lt;BR /&gt;sections) {&lt;BR /&gt;print if /owner\s+localexchange/ and /outage\s+CAD/;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&amp;gt;extract O380391mi&lt;BR /&gt;syntax error in file ./extract at line 2, next 2 tokens "local $/ "&lt;BR /&gt;syntax error in file ./extract at line 3, next 2 tokens "/,"&lt;BR /&gt;Execution of ./extract aborted due to compilation errors.&lt;BR /&gt;&lt;BR /&gt;2. If i redirect the output of the script&lt;BR /&gt;do i need to do the below way&lt;BR /&gt;extract O380391mi 1&amp;gt;report.out &lt;BR /&gt;or &lt;BR /&gt;any script needs to be modified?</description>
      <pubDate>Thu, 21 Sep 2006 07:45:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004612#M773421</guid>
      <dc:creator>vind123</dc:creator>
      <dc:date>2006-09-21T07:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004613#M773422</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;It appears that you are using a very old versino of Perl.  Try this:&lt;BR /&gt;&lt;BR /&gt;#!/usr/contrib/bin/perl&lt;BR /&gt;$/ = undef;&lt;BR /&gt;@sections = split( /toos_details/, &amp;lt;&amp;gt; );&lt;BR /&gt;for $_ (@sections) {&lt;BR /&gt;    print if /owner\s+localexchange/ &amp;amp;&amp;amp; /outage\s+CAD/;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Also, do:&lt;BR /&gt;&lt;BR /&gt;# /usr/contrib/bin/perl -v&lt;BR /&gt;&lt;BR /&gt;...If the version isn't 5.x then by all means fetch and install a current version:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://h20293.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=PERL" target="_blank"&gt;http://h20293.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=PERL&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 21 Sep 2006 08:00:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004613#M773422</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-21T08:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004614#M773423</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;Although I very much prefer Perl, here's an awk solution that fits your data:&lt;BR /&gt;&lt;BR /&gt;# awk 'BEGIN{RS=""};/localexchange/ &amp;amp;&amp;amp; /CAD/ {print $0;print ""}' file&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 21 Sep 2006 09:24:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004614#M773423</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-21T09:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004615#M773424</link>
      <description>1.  &lt;BR /&gt;&lt;BR /&gt;&amp;gt;cat extract1&lt;BR /&gt;#!/usr/contrib/bin/perl&lt;BR /&gt;$/ = undef;&lt;BR /&gt;sections = split( /toos_details/, &amp;lt;&amp;gt; );&lt;BR /&gt;sections) {&lt;BR /&gt;print if /owner\s+localexchange/ &amp;amp;&amp;amp; /outage\s+CAD/;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&amp;gt; extract1  O380391mi&lt;BR /&gt;Illegal item (LITERAL) as lvalue in file ./extract1 at line 3, next 2 tokens ");"&lt;BR /&gt;syntax error in file ./extract1 at line 4, next 2 tokens "sections)"&lt;BR /&gt;Execution of ./extract1 aborted due to compilation errors.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;2. &lt;BR /&gt;&lt;BR /&gt;&amp;gt; /usr/contrib/bin/perl -v&lt;BR /&gt;&lt;BR /&gt;This is perl, version 4.0&lt;BR /&gt;&lt;BR /&gt;$RCSfile: perl.c,v $$Revision: 4.0.1.8 $$Date: 1993/02/05 19:39:30 $&lt;BR /&gt;Patch level: 36&lt;BR /&gt;&lt;BR /&gt;Copyright (c) 1989, 1990, 1991, Larry Wall&lt;BR /&gt;&lt;BR /&gt;Perl may be copied only under the terms of either the Artistic License or the&lt;BR /&gt;GNU General Public License, which may be found in the Perl 4.0 source kit.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;3.  I will try with awk.</description>
      <pubDate>Thu, 21 Sep 2006 13:21:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004615#M773424</guid>
      <dc:creator>vind123</dc:creator>
      <dc:date>2006-09-21T13:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004616#M773425</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;In your last post (above):&lt;BR /&gt;&lt;BR /&gt;1.  You mis-pasted what I posted.&lt;BR /&gt;&lt;BR /&gt;2.  I suspected that you had a Perl 4.  That's ancient!  Upgrade to something more useful, as I suggested.&lt;BR /&gt;&lt;BR /&gt;3.  In the meantime, the 'awk' solution should help.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 21 Sep 2006 13:32:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004616#M773425</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-21T13:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004617#M773426</link>
      <description>awk script working. thx a lot. Also i want the count of toos_details that has local exchange and CAD. After printing the toos_details is it possible to print the total number of toos_details ? can it be done  in the awk script?</description>
      <pubDate>Fri, 22 Sep 2006 08:51:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004617#M773426</guid>
      <dc:creator>vind123</dc:creator>
      <dc:date>2006-09-22T08:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004618#M773427</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;Per you last request:&lt;BR /&gt;&lt;BR /&gt;# awk 'BEGIN{N=0;RS=""};/^toos_details/ {N++};/localexchange/ &amp;amp;&amp;amp; /CAD/ {print $0;print ""};END{print N}' file&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 22 Sep 2006 08:56:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004618#M773427</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-22T08:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004619#M773428</link>
      <description># awk 'BEGIN{RS=""}/CAD/&amp;amp;&amp;amp;/localexchange/{print;l++}END{print l}' infile&lt;BR /&gt;&lt;BR /&gt;~cheers</description>
      <pubDate>Sat, 23 Sep 2006 14:22:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004619#M773428</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-09-23T14:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004620#M773429</link>
      <description>Thanks a lot james and sandy. It's working. &lt;BR /&gt;The only change i made to james awk script is&lt;BR /&gt;awk 'BEGIN{N=0;RS=""};/localexchange/ &amp;amp;&amp;amp; /CAD/ {print $0;print "";N++};END{print N}' file&lt;BR /&gt;&lt;BR /&gt;Also how do i change this one if i want to print all the toos_details other than toos_details which have entries localexchange and cad &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 24 Sep 2006 05:07:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004620#M773429</guid>
      <dc:creator>vind123</dc:creator>
      <dc:date>2006-09-24T05:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004621#M773430</link>
      <description>To print all toos_details records...&lt;BR /&gt;&lt;BR /&gt;# awk 'BEGIN{RS=""}/toos_details/' inputfile</description>
      <pubDate>Sun, 24 Sep 2006 11:20:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004621#M773430</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-09-24T11:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004622#M773431</link>
      <description>Sandy,&lt;BR /&gt;&lt;BR /&gt;Basically  i want the toos_details records which doesn't have local exchange and CAD to be printed and not all the toos_details.</description>
      <pubDate>Mon, 25 Sep 2006 02:39:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004622#M773431</guid>
      <dc:creator>vind123</dc:creator>
      <dc:date>2006-09-25T02:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004623#M773432</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;You wrote, "Basically i want the toos_details records which doesn't have local exchange and CAD to be printed and not all the toos_details".&lt;BR /&gt;&lt;BR /&gt;For this, I suggest:&lt;BR /&gt;&lt;BR /&gt;# awk 'BEGIN{N=0;RS=""};!(/localexchange/ &amp;amp;&amp;amp; /CAD/) {print $0;print "";N++};END{print N}' file&lt;BR /&gt;&lt;BR /&gt;...The "!" negates the match expression.&lt;BR /&gt;&lt;BR /&gt;If you are interested in more 'awk' details, I suggest an examination of:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.gnu.org/software/gawk/manual/" target="_blank"&gt;http://www.gnu.org/software/gawk/manual/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 25 Sep 2006 06:58:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004623#M773432</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-25T06:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004624#M773433</link>
      <description>Thanks a lot for the info</description>
      <pubDate>Wed, 27 Sep 2006 02:45:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004624#M773433</guid>
      <dc:creator>vind123</dc:creator>
      <dc:date>2006-09-27T02:45:36Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004625#M773434</link>
      <description>Thanks a lot</description>
      <pubDate>Wed, 27 Sep 2006 02:54:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-shell-script/m-p/5004625#M773434</guid>
      <dc:creator>vind123</dc:creator>
      <dc:date>2006-09-27T02:54:35Z</dc:date>
    </item>
  </channel>
</rss>

