<?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: awk script help! in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-help/m-p/3083434#M811271</link>
    <description>Thank you John, that was good, I shall assign points to everybody, I need just time to test all the solutions.</description>
    <pubDate>Thu, 02 Oct 2003 06:08:02 GMT</pubDate>
    <dc:creator>Ionut Grigorescu_2</dc:creator>
    <dc:date>2003-10-02T06:08:02Z</dc:date>
    <item>
      <title>awk script help!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-help/m-p/3083426#M811263</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;attached a file from which I want to print out/extract only the BTS numbers under BTS column - at the end of the file, in this case 002,003,006. I want to filter out the BTS names - CITY2, METRO2 and all the other lines.It should be possible with awk but I'm still not that good :-)&lt;BR /&gt;&lt;BR /&gt;Any idea?</description>
      <pubDate>Thu, 02 Oct 2003 01:16:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-help/m-p/3083426#M811263</guid>
      <dc:creator>Ionut Grigorescu_2</dc:creator>
      <dc:date>2003-10-02T01:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: awk script help!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-help/m-p/3083427#M811264</link>
      <description>Hi,&lt;BR /&gt;how about a semi-awk construction:&lt;BR /&gt;# grep -e  "[0-9]*\ *[0-9]*CITY2\ *[0-9]*\ *METRO2"  &lt;YOUR_FILE&gt; |  awk '{print $1,","$2",",$4}'&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;regards,&lt;BR /&gt;John K.&lt;/YOUR_FILE&gt;</description>
      <pubDate>Thu, 02 Oct 2003 02:38:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-help/m-p/3083427#M811264</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2003-10-02T02:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: awk script help!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-help/m-p/3083428#M811265</link>
      <description>This works for me but you'll need to change the name of the datafile.&lt;BR /&gt; &lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;@DATA=`cat datafile`;&lt;BR /&gt;                  &lt;BR /&gt;while($i=shift @DATA){&lt;BR /&gt;        if($i =~ /BTS NAME/){&lt;BR /&gt;                shift @DATA;&lt;BR /&gt;                $line=shift @DATA;&lt;BR /&gt;                ($num1,$num2,$num3,$num4)=split " ",$line;&lt;BR /&gt;                print "$num1 $num2 $num4\n";&lt;BR /&gt;                exit 0;&lt;BR /&gt;        }&lt;BR /&gt;}&lt;BR /&gt;</description>
      <pubDate>Thu, 02 Oct 2003 02:40:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-help/m-p/3083428#M811265</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-10-02T02:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: awk script help!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-help/m-p/3083429#M811266</link>
      <description>1. The grep/awk combination doesn't help me - The CITY2 and METRO2 are only an example, the name of the BTS can be any combination of alpha-numeric characters but is always longer than 5 characters/digits, whreas BTS number is a 3 digit number between 0..248&lt;BR /&gt;&lt;BR /&gt;2. The perl script doesn't work - at line 8, next 2 tokens split " " - compilation error</description>
      <pubDate>Thu, 02 Oct 2003 03:39:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-help/m-p/3083429#M811266</guid>
      <dc:creator>Ionut Grigorescu_2</dc:creator>
      <dc:date>2003-10-02T03:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: awk script help!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-help/m-p/3083430#M811267</link>
      <description>Hi,&lt;BR /&gt;perhaps you can modify this awk to your needs:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;/BTS NAME/ { getline;getline; print $1,","$2",",$4}&lt;BR /&gt;&lt;BR /&gt;Run it like this:&lt;BR /&gt;# awk -f &lt;ABOVE_SCRIPT&gt;&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/ABOVE_SCRIPT&gt;</description>
      <pubDate>Thu, 02 Oct 2003 04:07:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-help/m-p/3083430#M811267</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2003-10-02T04:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: awk script help!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-help/m-p/3083431#M811268</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;if only the BTS columns have a 3 digits format, here is a solution using sed:&lt;BR /&gt;&lt;BR /&gt;# grep ^[0-9][0-9][0-9][^0-9] test|sed -e 's/[0-9][0-9][0-9]/\&lt;BR /&gt;/g'&lt;BR /&gt;&lt;BR /&gt;gives the result:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; CITY2&lt;BR /&gt; METRO2&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Please note that the substitution is on two lines, and that the \ on the first line indicates that the substitution is to continue on next line: it is&lt;BR /&gt;sed -e 's/[0-9][0-9][0-9]/\&lt;BR /&gt;/g'&lt;BR /&gt;&lt;BR /&gt;and not &lt;BR /&gt;sed -e 's/[0-9][0-9][0-9]/\/g'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;&lt;BR /&gt;FiX&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 02 Oct 2003 04:13:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-help/m-p/3083431#M811268</guid>
      <dc:creator>F. X. de Montgolfier</dc:creator>
      <dc:date>2003-10-02T04:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: awk script help!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-help/m-p/3083432#M811269</link>
      <description>That's odd,&lt;BR /&gt; &lt;BR /&gt;I just downloaded your example and did a cut and paste of the code from my browser, ran the script and this is what I got.&lt;BR /&gt; &lt;BR /&gt;bash-2.05a$ mv 17329.null datafile&lt;BR /&gt;bash-2.05a$ ./script.pl&lt;BR /&gt;002 003 006&lt;BR /&gt; &lt;BR /&gt;Perhaps your cut and paste put a newline somwhere in this line&lt;BR /&gt; &lt;BR /&gt;($num1,$num2,$num3,$num4)=split " ",$line;</description>
      <pubDate>Thu, 02 Oct 2003 05:05:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-help/m-p/3083432#M811269</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-10-02T05:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: awk script help!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-help/m-p/3083433#M811270</link>
      <description>From what I understand, you want to start capturing lines after "BTS NAME" followed by dashes, and stop at the next blank line, and for each line found, print each 3 digit number.&lt;BR /&gt;If that's your requirement, then this will do it.&lt;BR /&gt;Save to a file (eg my.awk), and use &lt;BR /&gt;  awk -f my.awk 17329.null&lt;BR /&gt;&lt;BR /&gt;BEGIN {btsfound=0}&lt;BR /&gt;/^BTS NAME/ {btsfound=1}&lt;BR /&gt;/^--/ {next}&lt;BR /&gt;/^[:space:]*$/ {print ; btsfound=0} # Look for whitespace&lt;BR /&gt;(btsfound==1) {&lt;BR /&gt;    for (i=1; i&amp;lt;=NF; i++) {&lt;BR /&gt;        if (match($i,"^[0-9][0-9][0-9]$") != 0)&lt;BR /&gt;            printf ("%s ", $i)&lt;BR /&gt;    }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;They will all be printed on one-line, space separated. Adjust the printf statements to suit your taste...&lt;BR /&gt;&lt;BR /&gt;Graham</description>
      <pubDate>Thu, 02 Oct 2003 05:08:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-help/m-p/3083433#M811270</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2003-10-02T05:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: awk script help!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-help/m-p/3083434#M811271</link>
      <description>Thank you John, that was good, I shall assign points to everybody, I need just time to test all the solutions.</description>
      <pubDate>Thu, 02 Oct 2003 06:08:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-help/m-p/3083434#M811271</guid>
      <dc:creator>Ionut Grigorescu_2</dc:creator>
      <dc:date>2003-10-02T06:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: awk script help!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-help/m-p/3083435#M811272</link>
      <description>Mark,&lt;BR /&gt;&lt;BR /&gt;I have re-tried your perl script - I have tried with copy and paste I have written it by hand in vi - nothing! I got the same compilation error in line 8. My Perl is 5.005_03 I have to use this version!&lt;BR /&gt;</description>
      <pubDate>Thu, 02 Oct 2003 06:35:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-help/m-p/3083435#M811272</guid>
      <dc:creator>Ionut Grigorescu_2</dc:creator>
      <dc:date>2003-10-02T06:35:14Z</dc:date>
    </item>
  </channel>
</rss>

