<?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: using awk with open in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/using-awk-with-open/m-p/5143022#M683103</link>
    <description>Hi (again) Ed:&lt;BR /&gt;&lt;BR /&gt;Since you are a new member, I'll ask you to please look at this, too:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums11.itrc.hp.com/service/forums/helptips.do?#28" target="_blank"&gt;http://forums11.itrc.hp.com/service/forums/helptips.do?#28&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Welcome and Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Tue, 25 Nov 2008 19:37:15 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2008-11-25T19:37:15Z</dc:date>
    <item>
      <title>using awk with open</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-awk-with-open/m-p/5143016#M683097</link>
      <description>I am new to perl so this might sound simple.&lt;BR /&gt;&lt;BR /&gt;Here is a little script I have been working on, from a flat file I can get it to work but not from a pipe. print &lt;INFO&gt; comes out as it should, but I am not sure why it dose not work for the while. &lt;BR /&gt;Any help would be appreciated.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;  #open(INFO, "iscan.txt");&lt;BR /&gt;  open(INFO, "ioscan -fnCdisk |awk '\$1==\"disk\" {getline dev; print \$0, dev }|");&lt;BR /&gt;&lt;BR /&gt;# print &lt;INFO&gt;;&lt;BR /&gt;&lt;BR /&gt;$search = "CX3";&lt;BR /&gt;while ( &lt;INFO&gt; ) {&lt;BR /&gt;  if (( /$search/ ) &amp;amp;&amp;amp; ( s/^.* $search-[234]0cWDR5 (.*) (.*)$/$2/ )) {&lt;BR /&gt;    print;&lt;BR /&gt;  }&lt;BR /&gt;}&lt;/INFO&gt;&lt;/INFO&gt;&lt;/INFO&gt;</description>
      <pubDate>Tue, 25 Nov 2008 18:30:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-awk-with-open/m-p/5143016#M683097</guid>
      <dc:creator>Ed Rantanen</dc:creator>
      <dc:date>2008-11-25T18:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: using awk with open</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-awk-with-open/m-p/5143017#M683098</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;You want a piped open:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;open(INFO, '-|', 'ioscan -fnCdisk' ) or die "Open error: $!\n";&lt;BR /&gt;&lt;BR /&gt;$search = "CX3";&lt;BR /&gt;while ( &lt;INFO&gt; ) {&lt;BR /&gt;    if (( /$search/ ) &amp;amp;&amp;amp; ( s/^.* $search-[234]0cWDR5 (.*) (.*)$/$2/ )) {&lt;BR /&gt;        print;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;/INFO&gt;</description>
      <pubDate>Tue, 25 Nov 2008 18:43:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-awk-with-open/m-p/5143017#M683098</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-11-25T18:43:28Z</dc:date>
    </item>
    <item>
      <title>Re: using awk with open</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-awk-with-open/m-p/5143018#M683099</link>
      <description>I am not a programmer...but...&lt;BR /&gt;your print command seems to be out of place.&lt;BR /&gt;&lt;BR /&gt;Here's a piece of one of my old ones.&lt;BR /&gt;&lt;BR /&gt;awk 'BEGIN {&lt;BR /&gt;  while ( "cat '$files' " | getline ) {&lt;BR /&gt;   entries++&lt;BR /&gt;   if ( $1 ~ "&lt;VALUE&gt;" ) print $1 }&lt;BR /&gt;   }&lt;BR /&gt;&lt;BR /&gt;The print is before the }.  &lt;BR /&gt;Rita&lt;BR /&gt;&lt;/VALUE&gt;</description>
      <pubDate>Tue, 25 Nov 2008 18:54:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-awk-with-open/m-p/5143018#M683099</guid>
      <dc:creator>Rita C Workman</dc:creator>
      <dc:date>2008-11-25T18:54:13Z</dc:date>
    </item>
    <item>
      <title>Re: using awk with open</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-awk-with-open/m-p/5143019#M683100</link>
      <description>I should have clarified better, when I do an ioscan  the lines have to be rejoined before use. &lt;BR /&gt;If I run the command &lt;BR /&gt;ioscan -fnCdisk | awk '$1=="disk" {getline dev; print $0, dev }â   &amp;gt; iscan.txt&lt;BR /&gt; the lines are joined. I was hoping to put the complete statement into the open(), and  then use INFO with the while.  I am trying to script out this process. &lt;BR /&gt;&lt;BR /&gt;Insf -e&lt;BR /&gt;Ioscan -fnCdisk&lt;BR /&gt;Pvcreate /dev/rdsk/c#t#d#&lt;BR /&gt;Lvextend&lt;BR /&gt;Lvcreate&lt;BR /&gt;Newfs&lt;BR /&gt;</description>
      <pubDate>Tue, 25 Nov 2008 19:02:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-awk-with-open/m-p/5143019#M683100</guid>
      <dc:creator>Ed Rantanen</dc:creator>
      <dc:date>2008-11-25T19:02:00Z</dc:date>
    </item>
    <item>
      <title>Re: using awk with open</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-awk-with-open/m-p/5143020#M683101</link>
      <description>Hi (again) Ed:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I should have clarified better, when I do an ioscan the lines have to be rejoined before use. &lt;BR /&gt;&lt;BR /&gt;OK, but you *still* don't want to mix 'awk' into Perl --- there's no need :-)&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;my $line   = '';&lt;BR /&gt;my $search = 'CX3';&lt;BR /&gt;&lt;BR /&gt;open(INFO, '-|', 'ioscan -fnCdisk' ) or die "Open error: $!\n";&lt;BR /&gt;&lt;BR /&gt;while ( &lt;INFO&gt; ) {&lt;BR /&gt;    next if m{^(Class|===)};&lt;BR /&gt;    chomp;&lt;BR /&gt;    if ( m{^disk} ) {&lt;BR /&gt;        $line = $_;&lt;BR /&gt;        next;&lt;BR /&gt;    }&lt;BR /&gt;    $_ = $line . $_;&lt;BR /&gt;    print "$_\n";&lt;BR /&gt;    if (( /$search/ ) &amp;amp;&amp;amp; ( s/^.* $search-[234]0cWDR5 (.*) (.*)$/$2/ )) {&lt;BR /&gt;        print;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;/INFO&gt;</description>
      <pubDate>Tue, 25 Nov 2008 19:13:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-awk-with-open/m-p/5143020#M683101</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-11-25T19:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: using awk with open</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-awk-with-open/m-p/5143021#M683102</link>
      <description>Thanks for the help!&lt;BR /&gt;&lt;BR /&gt;Made quick mod to the prints and it works great now. The hard part will be understanding the new junks of code.</description>
      <pubDate>Tue, 25 Nov 2008 19:33:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-awk-with-open/m-p/5143021#M683102</guid>
      <dc:creator>Ed Rantanen</dc:creator>
      <dc:date>2008-11-25T19:33:14Z</dc:date>
    </item>
    <item>
      <title>Re: using awk with open</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-awk-with-open/m-p/5143022#M683103</link>
      <description>Hi (again) Ed:&lt;BR /&gt;&lt;BR /&gt;Since you are a new member, I'll ask you to please look at this, too:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums11.itrc.hp.com/service/forums/helptips.do?#28" target="_blank"&gt;http://forums11.itrc.hp.com/service/forums/helptips.do?#28&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Welcome and Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 25 Nov 2008 19:37:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-awk-with-open/m-p/5143022#M683103</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-11-25T19:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: using awk with open</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-awk-with-open/m-p/5143023#M683104</link>
      <description>Thanks for the help problem solved.</description>
      <pubDate>Tue, 25 Nov 2008 19:40:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-awk-with-open/m-p/5143023#M683104</guid>
      <dc:creator>Ed Rantanen</dc:creator>
      <dc:date>2008-11-25T19:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: using awk with open</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-awk-with-open/m-p/5143024#M683105</link>
      <description>&amp;gt;awk '$1=="disk" {getline dev; print $0, dev }' &amp;gt; iscan.txt&lt;BR /&gt;&amp;gt;the lines are joined.&lt;BR /&gt;&lt;BR /&gt;Yes, it should do that.  Alternately you can use printf then print:&lt;BR /&gt;{ printf "%s", $0; getline; print $0 }</description>
      <pubDate>Tue, 25 Nov 2008 19:43:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-awk-with-open/m-p/5143024#M683105</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-11-25T19:43:30Z</dc:date>
    </item>
  </channel>
</rss>

