<?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, external command and quotes in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008103#M84465</link>
    <description>Hein wrote&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;Wow, that's just horrible. &lt;BR /&gt;Yes, I concur &lt;BR /&gt;:-)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;1) &lt;BR /&gt;What's the tolower doing in "if (/^Device/) {tolower" ? &lt;BR /&gt;&lt;BR /&gt;the bg device in the first list (with the pid) and the second list are one in uppercase and the other in lowercase, so the test failed&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;And is that substr stuff just to get of the ":"? &lt;BR /&gt;yes, because comparing bg227 and bg227: will fail :-)&lt;BR /&gt;&lt;BR /&gt;Then just split on that! &lt;BR /&gt;if (/^Device/) {split $2,x,":"); bg=tolower(x[1]) ;} &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;2) &lt;BR /&gt;... dev=toupper($2) &lt;BR /&gt;: &lt;BR /&gt;for (bg in prcnam) &lt;BR /&gt;if (bg == toupper(dev)) &lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;Is that second 'toupper' 'just in case the first one did not work?' &lt;BR /&gt;I forgot this one.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;I think all you need is: bg = dev .. but at a place where all the other data is collected. I don't have a system with 'ucx shwo dev/full' available right not. &lt;BR /&gt;But let's assume 'Bytes transferred' is the last line.&lt;BR /&gt;&lt;BR /&gt;Yes it is &lt;BR /&gt;In that case the solution show be: &lt;BR /&gt;&lt;BR /&gt;/Bytes transferred/ {byt = 0 ; byt=$3 ; byr= 0 ; byr=$4 ; &lt;BR /&gt;bg = dev; &lt;BR /&gt;printf(...) &lt;BR /&gt;} &lt;BR /&gt;&lt;BR /&gt;3) Should the printting of the header line (print("device... ) not be part of the BEGIN {} block? &lt;BR /&gt;May be, but anyway I want it at the back of the display, because I sort with the higher values at the end.&lt;BR /&gt;&lt;BR /&gt;4) Why 'awk' 4 times for 4 sort orders? &lt;BR /&gt;The data could change?! awk once, sort 4 times! Append to header lines after each sort. &lt;BR /&gt;&lt;BR /&gt;Yes of course&lt;BR /&gt;&lt;BR /&gt;Thanks for your inputs.</description>
    <pubDate>Fri, 01 Jun 2007 05:20:14 GMT</pubDate>
    <dc:creator>labadie_1</dc:creator>
    <dc:date>2007-06-01T05:20:14Z</dc:date>
    <item>
      <title>awk, external command and quotes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008088#M84450</link>
      <description>I am struggling with awk and an external command.&lt;BR /&gt;&lt;BR /&gt;I want to do, in a awk script, an external call to a Vms command&lt;BR /&gt;&lt;BR /&gt;If I do&lt;BR /&gt;$ gawk :== $ sys$common:[syshlp.examples.tcpip.snmp]gawk&lt;BR /&gt;&lt;BR /&gt;Then if I create a simple file a.awk&lt;BR /&gt;BEGIN{}&lt;BR /&gt;{ system(" wr sys$output f$time() ") }&lt;BR /&gt;Then the command&lt;BR /&gt;$ gawk/input=a.awk sys$input&lt;BR /&gt;followed by another RETURN&lt;BR /&gt;displays correctly the current time.&lt;BR /&gt;&lt;BR /&gt;Now, if I want to issue a command with quotes, like&lt;BR /&gt;wr sys$output f$getjpi("20400416","PRCNAM")&lt;BR /&gt;&lt;BR /&gt;I get various errors.&lt;BR /&gt;&lt;BR /&gt;I have tried various tripling of the quotes, to no avail.&lt;BR /&gt;&lt;BR /&gt;Thanks for any hint.</description>
      <pubDate>Mon, 28 May 2007 01:55:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008088#M84450</guid>
      <dc:creator>labadie_1</dc:creator>
      <dc:date>2007-05-28T01:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: awk, external command and quotes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008089#M84451</link>
      <description>Of course, putting the command in a file and doing in the awk @file&lt;BR /&gt;works, but does not solve my problem, as I will have a pid varying&lt;BR /&gt;&lt;BR /&gt;:-)</description>
      <pubDate>Mon, 28 May 2007 02:18:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008089#M84451</guid>
      <dc:creator>labadie_1</dc:creator>
      <dc:date>2007-05-28T02:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: awk, external command and quotes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008090#M84452</link>
      <description>&lt;!--!*#--&gt;Gerard,&lt;BR /&gt;&lt;BR /&gt;   Have you tried using PIPE? Perhaps something like:&lt;BR /&gt;&lt;BR /&gt;$ PIPE WRITE SYS$OUTPUT "something" | -&lt;BR /&gt;  GAWK/input=a.awk SYS$PIPE:&lt;BR /&gt;&lt;BR /&gt;  I find this is often a simple way of generating variable input without writing a temporary file. If the input is complex, you can use a command procedure to avoid having multiple continuation lines in the PIPE command, like this:&lt;BR /&gt;&lt;BR /&gt;$ self=F$PARSE(";",F$ENVIRONMENT("PROCEDURE"))&lt;BR /&gt;$ IF p1.EQS."INPUT" THEN GOTO Input&lt;BR /&gt;$ IF p1.EQS."OUTPUT" THEN GOTO Output&lt;BR /&gt;$ PIPE @'self' "INPUT" | @'self' "OUTPUT"&lt;BR /&gt;$ EXIT&lt;BR /&gt;$&lt;BR /&gt;$ Input:&lt;BR /&gt;$   ! Generate your input stream here&lt;BR /&gt;$   ! using WRITE SYS$OUTPUT&lt;BR /&gt;$ EXIT&lt;BR /&gt;$&lt;BR /&gt;$ Output:&lt;BR /&gt;$   ! Execute command to consume the output&lt;BR /&gt;$ EXIT&lt;BR /&gt;&lt;BR /&gt;(in your case you probably don't need the output branch, use your AWK command instead).</description>
      <pubDate>Mon, 28 May 2007 03:06:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008090#M84452</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2007-05-28T03:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: awk, external command and quotes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008091#M84453</link>
      <description>Thanks John for the general method.&lt;BR /&gt;&lt;BR /&gt;I realize I have not correctly explained my problem.&lt;BR /&gt;&lt;BR /&gt;I am still working on the procedure I posted in the thread on "monitor network traffic"&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1120946" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1120946&lt;/A&gt;&lt;BR /&gt;(By the way I have fixed a bug)&lt;BR /&gt;It displays some interesting data, like&lt;BR /&gt;&lt;BR /&gt;BG270  ,Stream  ,  705,49153,       127.0.0.1,       127.0.0.1,           280,             0,          15,           0&lt;BR /&gt;BG778  ,Stream  ,  705,49185,       127.0.0.1,       127.0.0.1,         18748,             0,        1853,           0&lt;BR /&gt;BG281  ,Stream  ,49154,  705,       127.0.0.1,       127.0.0.1,         25704,             0,        1837,           0&lt;BR /&gt;BG30531,Stream  ,57678, 1800,   193.248.1.155,    10.196.10.30,         62464,             0,         245,           0&lt;BR /&gt;BG260  ,Dgram   ,  161,    0,    &lt;INADDR_ANY&gt;,    &lt;INADDR_ANY&gt;,        200310,             0,        5372,           0&lt;BR /&gt;BG604  ,Dgram   , 3181,    0,         0.0.0.0,    &lt;INADDR_ANY&gt;,        364228,             0,       35016,           0&lt;BR /&gt;BG32505,Stream  , 1190,32801,   193.248.1.156,    10.196.11.80,        556708,             0,       59625,           0&lt;BR /&gt;BG24149,Stream  ,50031, 1501,   193.248.1.155,  10.196.138.225,       2365544,             0,      253419,           0&lt;BR /&gt;BG671  ,Stream  , 1190,42865,   193.248.1.156,  10.196.138.225,      15110388,             0,      260926,           0&lt;BR /&gt;BG710  ,Stream  ,49182, 1616,   193.248.1.155, 193.248.120.121,      23229596,             0,     2488443,           0&lt;BR /&gt;BG711  ,Stream  ,49183, 1515,   193.248.1.155, 193.248.120.120,     195537460,             0,    20934757,           0&lt;BR /&gt;BG749  ,Stream  , 1190,60648,   193.248.1.156, 193.248.120.121,     826776008,             0,     3051698,           0&lt;BR /&gt;BG1201 ,Stream  , 1190,64562,   193.248.1.156, 193.248.120.120,     880459944,             0,    22705543,           0&lt;BR /&gt;Device | type  | ploc | prem | host local     | host remote  |   bytes rec  |   bytes sent  |  I/O rec   |  I/O sen  |&lt;BR /&gt;____________________________________________________________________________________________________________________&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;And I thought it could be good to add the pid and processname owning the Bg device.&lt;BR /&gt;&lt;BR /&gt;So it is while I am inside awk that I want to get some info from Vms, typically&lt;BR /&gt;&lt;BR /&gt;f$getdvi("bg123","pid") &lt;BR /&gt;and&lt;BR /&gt;f$getjpi(f$getdvi("bg123","pid"),"prcnam") &lt;BR /&gt;&lt;BR /&gt;&lt;/INADDR_ANY&gt;&lt;/INADDR_ANY&gt;&lt;/INADDR_ANY&gt;</description>
      <pubDate>Mon, 28 May 2007 03:18:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008091#M84453</guid>
      <dc:creator>labadie_1</dc:creator>
      <dc:date>2007-05-28T03:18:04Z</dc:date>
    </item>
    <item>
      <title>Re: awk, external command and quotes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008092#M84454</link>
      <description>In fact, I think the problem is in the syntax: in the awk file, I must have&lt;BR /&gt;{ system(" vmscommand ")}&lt;BR /&gt;So as long as I have&lt;BR /&gt;$ sh system&lt;BR /&gt;$ sh time&lt;BR /&gt;$ write sys$output f$time()&lt;BR /&gt;$ wr sys$output 1&lt;BR /&gt;&lt;BR /&gt;It works fine.&lt;BR /&gt;&lt;BR /&gt;But when I want to issue a command such as&lt;BR /&gt;$ wr sys$output "abcdef"&lt;BR /&gt;or any other with the character "&lt;BR /&gt;the parser wrongly takes the first " of the vms command as the end of the vms command&lt;BR /&gt;&lt;BR /&gt;In fact, if you put as vms command&lt;BR /&gt;write sys$output "abcdef"&lt;BR /&gt;or &lt;BR /&gt;write sys$output&lt;BR /&gt;&lt;BR /&gt;you get the same result&lt;BR /&gt;_Expression&lt;BR /&gt;&lt;BR /&gt;:-(</description>
      <pubDate>Mon, 28 May 2007 04:06:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008092#M84454</guid>
      <dc:creator>labadie_1</dc:creator>
      <dc:date>2007-05-28T04:06:04Z</dc:date>
    </item>
    <item>
      <title>Re: awk, external command and quotes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008093#M84455</link>
      <description>You're not thinking UNIX.&lt;BR /&gt;&lt;BR /&gt;alp $ type a.awk&lt;BR /&gt;BEGIN{}&lt;BR /&gt;{ system(" write sys$output f$time() ") }&lt;BR /&gt;&lt;BR /&gt;alp $ gawk /inp = a.awk sys$input&lt;BR /&gt;&lt;BR /&gt;28-MAY-2007 07:55:48.97&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;And:&lt;BR /&gt;&lt;BR /&gt;alp $ type b.awk&lt;BR /&gt;BEGIN{}&lt;BR /&gt;{ system(" write sys$output f$edit( f$time(), "COLLAPSE") ") }&lt;BR /&gt;&lt;BR /&gt;alp $ type b.awk&lt;BR /&gt;BEGIN{}&lt;BR /&gt;{ system(" write sys$output f$edit( f$time(), "COLLAPSE") ") }&lt;BR /&gt;alp $ gawk /inp = b.awk sys$input&lt;BR /&gt;&lt;BR /&gt;%DCL-W-ARGREQ, missing argument - supply all required arguments&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;But:&lt;BR /&gt;&lt;BR /&gt;alp $ type c.awk&lt;BR /&gt;BEGIN{}&lt;BR /&gt;{ system(" write sys$output f$edit( f$time(), \"COLLAPSE\") ") }&lt;BR /&gt;&lt;BR /&gt;alp $ gawk /inp = c.awk sys$input&lt;BR /&gt;&lt;BR /&gt;28-MAY-200707:56:54.23&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 28 May 2007 07:58:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008093#M84455</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2007-05-28T07:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: awk, external command and quotes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008094#M84456</link>
      <description>Free advice...&lt;BR /&gt;&lt;BR /&gt;If you are going to do those getjpi prcnam for several sessions, then you may want to just pre-read some "show system" and stick the results into an array:&lt;BR /&gt;&lt;BR /&gt;---- awk script ----&lt;BR /&gt;BEGIN { while ("show system" | getline) {&lt;BR /&gt;      getjpi_prcnam[$1] = substr($0,10,15)&lt;BR /&gt;      }&lt;BR /&gt;}&lt;BR /&gt;---------------------&lt;BR /&gt;&lt;BR /&gt;Now you can just use getjpi_prcnam[pid] and know you are not spawning the system to a crawl. &lt;BR /&gt;&lt;BR /&gt;But was the original input not from "show dev bg"? So you could just pick up process name and pic fron shwo dev/bg/full:&lt;BR /&gt;&lt;BR /&gt;-----------------&lt;BR /&gt;BEGIN { while ("show device bg/full" | getline) {&lt;BR /&gt;      if (/^Device/ ) {split ($2,x,","); bg = x[1];}&lt;BR /&gt;      if (/UIC/) { split ($0,x,"\""); prcnam[bg] = x[2] }&lt;BR /&gt;      if (/Owner process ID/) { pid[bg] = $4; print bg, x[2], $4; bg="X" }&lt;BR /&gt;      }&lt;BR /&gt;&lt;BR /&gt;for (bg in prcnam) {&lt;BR /&gt;   print bg,  pid[bg], prcnam[bg];&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Or in original order:&lt;BR /&gt;--------------------------------&lt;BR /&gt;&lt;BR /&gt;BEGIN { while ("show device bg/full" | getline) {&lt;BR /&gt;      if (/^Device/ ) {units++; split ($2,x,",");  bg[units] = x[1];}&lt;BR /&gt;      if (/UIC/) { split ($0,x,"\""); prcnam[units] = x[2] }&lt;BR /&gt;      if (/Owner process ID/) { pid[units] = $4; getjpi_prcnam[$4]=x[2] }&lt;BR /&gt;      }&lt;BR /&gt;while (i++ &amp;lt; units) {&lt;BR /&gt;   print bg[i],  pid[i], prcnam[i];&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I suspect the PERL is more suitable for this job though.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Enjoy,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Mon, 28 May 2007 10:55:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008094#M84456</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-05-28T10:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: awk, external command and quotes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008095#M84457</link>
      <description>Steven&lt;BR /&gt;&lt;BR /&gt;Thanks for the tip, I should have known better, as I had struggled with a Linux command on several other Linux nodes with rsh and echo $HOSTNAME&lt;BR /&gt;:-)&lt;BR /&gt;&lt;BR /&gt;Hein&lt;BR /&gt;Thanks for the valuable info, but as I do&lt;BR /&gt;$ ana/sys&lt;BR /&gt;tcpip sh dev/fu bg&lt;BR /&gt;&lt;BR /&gt;I do not have the pid and processname owning the bg edvice.&lt;BR /&gt;&lt;BR /&gt;$ sh dev /fu bgxxx&lt;BR /&gt;gives it, but not the counters, remote and local port, remote and local host... &lt;BR /&gt;&lt;BR /&gt;And &lt;BR /&gt;$ tcpip sh dev/fu bgxxx&lt;BR /&gt;gives data with a "bad format", not good for searching</description>
      <pubDate>Mon, 28 May 2007 14:14:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008095#M84457</guid>
      <dc:creator>labadie_1</dc:creator>
      <dc:date>2007-05-28T14:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: awk, external command and quotes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008096#M84458</link>
      <description>&amp;gt;&amp;gt; $ ana/sys .... tcpip sh dev/fu bg &lt;BR /&gt;&amp;gt;&amp;gt; I do not have the pid and processname owning the bg edvice. &lt;BR /&gt;&lt;BR /&gt;I only see a PID in that output if there is an active IRP. &lt;BR /&gt;&lt;BR /&gt;So I'm suggesting that if you do the regular DCL $SHOW DEV BG/FULL early, in the BEGIN section of the awk, then you can establish a known mapping from BG device name to PID and/or PRCNAM, through a simple bunch of arrays.&lt;BR /&gt;Then as you process the ANAL/SYS output, you can latch on to the BG name and look it up in those arrays for pid and/or prcnam.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;. $ tcpip sh dev/fu bgxxx &lt;BR /&gt;gives data with a "bad format", not good for searching &lt;BR /&gt;&lt;BR /&gt;yeah, sort of. It creates a long (815) byte record with embedded CR-LF. &lt;BR /&gt;&lt;BR /&gt;That's what breaks a simple $PIPE  tcpip sh dev/fu bgxxx | TYPE/PAGE/&lt;BR /&gt;&lt;BR /&gt;It's not all that hard to process and specificall PERL automatically breaks it down into lines. &lt;BR /&gt;&lt;BR /&gt;If you stick the output into a file, and then $convert/fdl="record; format stream" then the output will show as individual lines as well.&lt;BR /&gt;&lt;BR /&gt;fwiw,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Mon, 28 May 2007 14:43:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008096#M84458</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-05-28T14:43:25Z</dc:date>
    </item>
    <item>
      <title>Re: awk, external command and quotes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008097#M84459</link>
      <description>You could surely just pass the pid into the script:&lt;BR /&gt;&lt;BR /&gt;$ gawk -v pid=val -f script.awk</description>
      <pubDate>Tue, 29 May 2007 09:04:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008097#M84459</guid>
      <dc:creator>Sebastian Bazley</dc:creator>
      <dc:date>2007-05-29T09:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: awk, external command and quotes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008098#M84460</link>
      <description>FYI: With judicious use of quotes, you can do useful things directly from DCL *without* a secondary script file. The trick is understanding when to 'escape' a quotation mark, and when to double it. Or both. 8^)&lt;BR /&gt;Here are a couple 'one-liners' from my collection:&lt;BR /&gt;&lt;BR /&gt;Initialize any disks that have *never* been initialized:&lt;BR /&gt;------&lt;BR /&gt;pipe sho dev dg | gawk "BEGIN {print ""$set noon""}; /Online/ {print ""$mou /over=id /noassi"", $1; print ""$if f$mess( $status, \""ident\"") .eqs. \""%NOHOMEBLK\"" -""; print "" then init/sys /limit"", $1, ""UNUSED""}" sys$pipe: | @sys$pipe:&lt;BR /&gt;&lt;BR /&gt;Show the size of all locally mounted disks (in MB):&lt;BR /&gt;------&lt;BR /&gt;pipe show dev d/mou | GAWK "/Mounted/ &amp;amp;&amp;amp; !/(remote mount)/ {print ""$ write sys$output \"""" $1 ""\t\"", f$getdvi( \"""" $1 ""\"", \""maxblock\""), \"" bl.\t\"", f$getdvi( \"""" $1 ""\"", \""maxblock\"")/2048, \"" MB\""""}" sys$pipe: | @sys$pipe:</description>
      <pubDate>Tue, 29 May 2007 09:07:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008098#M84460</guid>
      <dc:creator>Sheldon Smith</dc:creator>
      <dc:date>2007-05-29T09:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: awk, external command and quotes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008099#M84461</link>
      <description>Sebastian&lt;BR /&gt;&lt;BR /&gt;I am not sure I understand: I have a variable number of BG devices, say 50, so passing a pid will not help&lt;BR /&gt;&lt;BR /&gt;Sheldon&lt;BR /&gt;&lt;BR /&gt;Thanks a bunch for the procedures, I will have a close look</description>
      <pubDate>Tue, 29 May 2007 09:23:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008099#M84461</guid>
      <dc:creator>labadie_1</dc:creator>
      <dc:date>2007-05-29T09:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: awk, external command and quotes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008100#M84462</link>
      <description>Sorry, missed that part of the thread.&lt;BR /&gt;&lt;BR /&gt;However you could join the pids (e.g. with a comma) if you wanted, and then split them again...&lt;BR /&gt;&lt;BR /&gt;Or of course, put the raw pid details in a file that is read by the awk script.</description>
      <pubDate>Tue, 29 May 2007 09:32:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008100#M84462</guid>
      <dc:creator>Sebastian Bazley</dc:creator>
      <dc:date>2007-05-29T09:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: awk, external command and quotes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008101#M84463</link>
      <description>I have attached the last version of my awk script.&lt;BR /&gt;&lt;BR /&gt;It defines some symbols&lt;BR /&gt;- statbyr&lt;BR /&gt;sorts the BG Devices by Bytes received&lt;BR /&gt;- statbys&lt;BR /&gt;sorts the BG Devices by Bytes sent&lt;BR /&gt;- statior&lt;BR /&gt;sorts the Bg devices by I/O received&lt;BR /&gt;- statios&lt;BR /&gt;sorts the Bg devices by I/O sent&lt;BR /&gt;&lt;BR /&gt;It is highly inefficient, as I do&lt;BR /&gt;for (bg in prcnam)&lt;BR /&gt;   if (bg == toupper(dev))&lt;BR /&gt;   printf ...&lt;BR /&gt;&lt;BR /&gt;So if I have 200 bg devices, I will be 200x200 times in this loop&lt;BR /&gt;&lt;BR /&gt;I have been surprised to discover that without the line&lt;BR /&gt;for (bg in prcnam), I do not find any array member.&lt;BR /&gt;&lt;BR /&gt;Some with a higher knowledge of awk may explain it.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 01 Jun 2007 03:00:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008101#M84463</guid>
      <dc:creator>labadie_1</dc:creator>
      <dc:date>2007-06-01T03:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: awk, external command and quotes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008102#M84464</link>
      <description>Wow, that's just horrible.&lt;BR /&gt;&lt;BR /&gt;1)&lt;BR /&gt;What's the tolower doing in "if (/^Device/) {tolower" ?&lt;BR /&gt;Did you mean: &lt;BR /&gt;if (/^Device/) {split (substr($2,1,(length($2)-2)),x,","); bg=tolower(x[1]) ;}&lt;BR /&gt;&lt;BR /&gt;And is that substr stuff just to get of the ":"?&lt;BR /&gt;Then just split on that!&lt;BR /&gt;if (/^Device/) {split $2,x,":"); bg=tolower(x[1]) ;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;2)&lt;BR /&gt;... dev=toupper($2)&lt;BR /&gt;:&lt;BR /&gt;for (bg  in prcnam)&lt;BR /&gt;         if (bg == toupper(dev))&lt;BR /&gt;&lt;BR /&gt;Is that second 'toupper' 'just in case the first one did not work?'&lt;BR /&gt;&lt;BR /&gt;I think all you need is: bg = dev .. but at a place where all the other data is collected. I don't have a system with 'ucx shwo dev/full' available right not.&lt;BR /&gt;But let's assume 'Bytes transferred' is the last line.&lt;BR /&gt;In that case the solution show be:&lt;BR /&gt;&lt;BR /&gt;/Bytes transferred/ {byt = 0 ; byt=$3 ; byr= 0 ; byr=$4 ;&lt;BR /&gt;bg = dev;&lt;BR /&gt;printf(...)&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;3) Should the printting of the header line (print("device... ) not be part of the BEGIN {} block?&lt;BR /&gt; &lt;BR /&gt;4) Why 'awk' 4 times for 4 sort orders?&lt;BR /&gt;The data could change?! awk once, sort 4 times! Append to header lines after each sort.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 01 Jun 2007 05:07:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008102#M84464</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-06-01T05:07:02Z</dc:date>
    </item>
    <item>
      <title>Re: awk, external command and quotes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008103#M84465</link>
      <description>Hein wrote&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;Wow, that's just horrible. &lt;BR /&gt;Yes, I concur &lt;BR /&gt;:-)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;1) &lt;BR /&gt;What's the tolower doing in "if (/^Device/) {tolower" ? &lt;BR /&gt;&lt;BR /&gt;the bg device in the first list (with the pid) and the second list are one in uppercase and the other in lowercase, so the test failed&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;And is that substr stuff just to get of the ":"? &lt;BR /&gt;yes, because comparing bg227 and bg227: will fail :-)&lt;BR /&gt;&lt;BR /&gt;Then just split on that! &lt;BR /&gt;if (/^Device/) {split $2,x,":"); bg=tolower(x[1]) ;} &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;2) &lt;BR /&gt;... dev=toupper($2) &lt;BR /&gt;: &lt;BR /&gt;for (bg in prcnam) &lt;BR /&gt;if (bg == toupper(dev)) &lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;Is that second 'toupper' 'just in case the first one did not work?' &lt;BR /&gt;I forgot this one.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;I think all you need is: bg = dev .. but at a place where all the other data is collected. I don't have a system with 'ucx shwo dev/full' available right not. &lt;BR /&gt;But let's assume 'Bytes transferred' is the last line.&lt;BR /&gt;&lt;BR /&gt;Yes it is &lt;BR /&gt;In that case the solution show be: &lt;BR /&gt;&lt;BR /&gt;/Bytes transferred/ {byt = 0 ; byt=$3 ; byr= 0 ; byr=$4 ; &lt;BR /&gt;bg = dev; &lt;BR /&gt;printf(...) &lt;BR /&gt;} &lt;BR /&gt;&lt;BR /&gt;3) Should the printting of the header line (print("device... ) not be part of the BEGIN {} block? &lt;BR /&gt;May be, but anyway I want it at the back of the display, because I sort with the higher values at the end.&lt;BR /&gt;&lt;BR /&gt;4) Why 'awk' 4 times for 4 sort orders? &lt;BR /&gt;The data could change?! awk once, sort 4 times! Append to header lines after each sort. &lt;BR /&gt;&lt;BR /&gt;Yes of course&lt;BR /&gt;&lt;BR /&gt;Thanks for your inputs.</description>
      <pubDate>Fri, 01 Jun 2007 05:20:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008103#M84465</guid>
      <dc:creator>labadie_1</dc:creator>
      <dc:date>2007-06-01T05:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: awk, external command and quotes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008104#M84466</link>
      <description>I have done as you said, as Bytes transferred is the last motif searched&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;But let's assume 'Bytes transferred' is the last line. &lt;BR /&gt;In that case the solution show be: &lt;BR /&gt;&lt;BR /&gt;/Bytes transferred/ {byt = 0 ; byt=$3 ; byr= 0 ; byr=$4 ; &lt;BR /&gt;bg = dev; &lt;BR /&gt;printf(...) &lt;BR /&gt;} &lt;BR /&gt;&lt;BR /&gt;And I no longer have the pid and prcnam.&lt;BR /&gt;&lt;BR /&gt;There is something I have not understood in the flow of data in awk...&lt;BR /&gt;&lt;BR /&gt;:-(&lt;BR /&gt;</description>
      <pubDate>Fri, 01 Jun 2007 05:45:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008104#M84466</guid>
      <dc:creator>labadie_1</dc:creator>
      <dc:date>2007-06-01T05:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: awk, external command and quotes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008105#M84467</link>
      <description>I suspect there is still a slight punctuation error on the device name.&lt;BR /&gt;&lt;BR /&gt;Print them out for a debug run, may on 1 device?&lt;BR /&gt;&lt;BR /&gt;Email me a sample SHOW DEV BG/FULL as well as a sample UCX SHOW DEV/FULL and I'll see if I can find time to cehck it.&lt;BR /&gt;&lt;BR /&gt;Flow in AWK is a surprise for first time users.&lt;BR /&gt;The main flow is 'all code' for all record in the input.&lt;BR /&gt;The /something/ {block} construct is really an 'if ($0 look like something) then {block}'&lt;BR /&gt;&lt;BR /&gt;Most awk programs have simple {} block with no conditional, making that run for every line.&lt;BR /&gt;&lt;BR /&gt;You can add a BEGIN {} and END {} which run jsut once typically to setup, print header fin BEGIN, and to print a total in END.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 01 Jun 2007 06:24:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008105#M84467</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-06-01T06:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: awk, external command and quotes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008106#M84468</link>
      <description>Hein&lt;BR /&gt;&lt;BR /&gt;I have emailed you the various files.&lt;BR /&gt;Thanks for your time.&lt;BR /&gt;&lt;BR /&gt;I am trying to debug.</description>
      <pubDate>Fri, 01 Jun 2007 06:48:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008106#M84468</guid>
      <dc:creator>labadie_1</dc:creator>
      <dc:date>2007-06-01T06:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: awk, external command and quotes</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008107#M84469</link>
      <description>Thanks to Hein, the procedure now displays the pid and processname for each bg, without looping too much :-)&lt;BR /&gt;&lt;BR /&gt;It is available at &lt;BR /&gt;&lt;A href="http://dcl.openvms.org/stories.php?story=07/06/04/4359262" target="_blank"&gt;http://dcl.openvms.org/stories.php?story=07/06/04/4359262&lt;/A&gt;</description>
      <pubDate>Thu, 14 Jun 2007 03:03:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/awk-external-command-and-quotes/m-p/4008107#M84469</guid>
      <dc:creator>labadie_1</dc:creator>
      <dc:date>2007-06-14T03:03:13Z</dc:date>
    </item>
  </channel>
</rss>

