<?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 question:  Change /dev/dsk/c101t2d4 -&amp;gt; c101t2d4 in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919977#M104307</link>
    <description>oops that probably should be a[4] instead of a[3], but you could figure that out.&lt;BR /&gt;&lt;BR /&gt;sandman, nice syntax to get the last field.  i'll have to write that one done.</description>
    <pubDate>Mon, 22 Aug 2005 11:18:01 GMT</pubDate>
    <dc:creator>curt larson_1</dc:creator>
    <dc:date>2005-08-22T11:18:01Z</dc:date>
    <item>
      <title>awk question:  Change /dev/dsk/c101t2d4 -&gt; c101t2d4</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919970#M104300</link>
      <description>Consider this:  I use the following awk script to reduce the 'syminq -v -clar' report to one &lt;BR /&gt;        line: &lt;BR /&gt;&lt;BR /&gt;            Device Physical Name     : /dev/rdsk/c101t5d3 &lt;BR /&gt;            Device Serial ID         : Ch2 CONT &lt;BR /&gt;            Vendor ID                : DGC &lt;BR /&gt;            Product ID               : CX700WDR5 &lt;BR /&gt;            Product Revision         : HP03 &lt;BR /&gt;            Capacity (in KB)         :    8838720 &lt;BR /&gt;            Clariion ID              : APM00052802175 &lt;BR /&gt;            Device Clariion Name     : 0117 &lt;BR /&gt;            Device State             : ASSIGNED &lt;BR /&gt;            VxVM DMP Device Type     : N/A &lt;BR /&gt;&lt;BR /&gt;            Device Physical Name     : /dev/rdsk/c101t5d4 &lt;BR /&gt;            Device Serial ID         : Ch2 CONT &lt;BR /&gt;            Vendor ID                : DGC &lt;BR /&gt;            Product ID               : CX700WDR5 &lt;BR /&gt;            Product Revision         : HP03 &lt;BR /&gt;            Capacity (in KB)         :   70709760 &lt;BR /&gt;            Clariion ID              : APM00052802175 &lt;BR /&gt;            Device Clariion Name     : 0116 &lt;BR /&gt;            Device State             : ASSIGNED &lt;BR /&gt;            VxVM DMP Device Type     : N/A &lt;BR /&gt;&lt;BR /&gt;b.      Do this: &lt;BR /&gt;&lt;BR /&gt;        awk ' &lt;BR /&gt;                /Device Phys/   {CTD=$5; next} &lt;BR /&gt;                /Product ID/    {PROD=$4; next} &lt;BR /&gt;                /Capacity/      {CAP=$5; next} &lt;BR /&gt;                /Clariion ID/   {ARRAY=$4; next} &lt;BR /&gt;                /Device Clar/   {LUN=$5; next} &lt;BR /&gt;                /VxVM/          {print CTD, PROD, CAP/1000000, ARRAY, LUN}' \ &lt;BR /&gt;                                                                 syminq-v-clar &lt;BR /&gt;&lt;BR /&gt;        /dev/rdsk/c101t5d3 CX700WDR5 8.83872 APM00052802175 0117 &lt;BR /&gt;        /dev/rdsk/c101t5d4 CX700WDR5 70.7098 APM00052802175 0116 &lt;BR /&gt;&lt;BR /&gt;c.  But I don't want "/dev/rdsk/c101t5d3".&lt;BR /&gt;&lt;BR /&gt;I want "c101t5d3".&lt;BR /&gt;&lt;BR /&gt;d.  So, how do I modify the above little awk program to strip out the "/dev/dsk/".&lt;BR /&gt;&lt;BR /&gt;I have been messing around with "sub" and "gsub", with no good result.&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Aug 2005 10:39:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919970#M104300</guid>
      <dc:creator>Stuart Abramson</dc:creator>
      <dc:date>2005-08-22T10:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: awk question:  Change /dev/dsk/c101t2d4 -&gt; c101t2d4</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919971#M104301</link>
      <description>Hi Stuert,&lt;BR /&gt;&lt;BR /&gt;I assume your final out put is now &lt;BR /&gt;&lt;BR /&gt;dev/rdsk/c101t5d3 CX700WDR5 8.83872 APM00052802175 0117 &lt;BR /&gt;/dev/rdsk/c101t5d4 CX700WDR5 70.7098 APM00052802175 0116 &lt;BR /&gt;&lt;BR /&gt;Now to eliminate the /dev/rdsk you can input this output to &lt;BR /&gt;&lt;BR /&gt;awk '{print $1 }'|cut -f 4 -d "/"&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Syam</description>
      <pubDate>Mon, 22 Aug 2005 10:51:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919971#M104301</guid>
      <dc:creator>Ranjith_5</dc:creator>
      <dc:date>2005-08-22T10:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: awk question:  Change /dev/dsk/c101t2d4 -&gt; c101t2d4</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919972#M104302</link>
      <description>I'm no awk expert, but you can change the field seperator or delimiter with -F.&lt;BR /&gt;&lt;BR /&gt;My limited brain says to just re-awk the first element in each line with something like:&lt;BR /&gt;&lt;BR /&gt;awk -F "/" {'print $4'}&lt;BR /&gt;&lt;BR /&gt;I'm sure someone with more awk knowledge can find a better way to streamline it into your existing code.</description>
      <pubDate>Mon, 22 Aug 2005 10:54:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919972#M104302</guid>
      <dc:creator>Pat Lieberg</dc:creator>
      <dc:date>2005-08-22T10:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: awk question:  Change /dev/dsk/c101t2d4 -&gt; c101t2d4</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919973#M104303</link>
      <description>It's dumb to use the external command cut when awk can do this internally and more efficiently. Look at the awk function sub (or gsub)&lt;BR /&gt;&lt;BR /&gt;sub(r,s,t)&lt;BR /&gt;&lt;BR /&gt;Substitute s for the first match of the RE r in the string t. If argument t is not supplied, $0 is used. You can substitute a null string to remove matching RE's.&lt;BR /&gt;&lt;BR /&gt;RE =&amp;gt; regular expression&lt;BR /&gt;&lt;BR /&gt;Sub returns 1 if okay and 0 otherwise.</description>
      <pubDate>Mon, 22 Aug 2005 10:59:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919973#M104303</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-08-22T10:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: awk question:  Change /dev/dsk/c101t2d4 -&gt; c101t2d4</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919974#M104304</link>
      <description>how about piping your output string into this &lt;BR /&gt;&lt;BR /&gt;... | sed -e "1,1s+/dev/dsk/++&lt;BR /&gt;&lt;BR /&gt;I think it will eliminate the string.</description>
      <pubDate>Mon, 22 Aug 2005 11:00:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919974#M104304</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2005-08-22T11:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: awk question:  Change /dev/dsk/c101t2d4 -&gt; c101t2d4</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919975#M104305</link>
      <description>using split would seem to work better&lt;BR /&gt;&lt;BR /&gt;change&lt;BR /&gt;&lt;BR /&gt;/Device Phys/ {CTD=$5; next} &lt;BR /&gt;&lt;BR /&gt;to &lt;BR /&gt;&lt;BR /&gt;/Device Phys/ {split($5,a,"/"); CTD=a[3];next;}</description>
      <pubDate>Mon, 22 Aug 2005 11:00:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919975#M104305</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2005-08-22T11:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: awk question:  Change /dev/dsk/c101t2d4 -&gt; c101t2d4</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919976#M104306</link>
      <description>Change the awk line that handles the "Device Phy" pattern slightly. The rest of the awk script remains unchanged:&lt;BR /&gt;&lt;BR /&gt;=============================================&lt;BR /&gt;awk ' &lt;BR /&gt;/Device Phys/ {CTD=z[split($5,z,"/")]; next} &lt;BR /&gt;/Product ID/ {PROD=$4; next} &lt;BR /&gt;/Capacity/ {CAP=$5; next} &lt;BR /&gt;/Clariion ID/ {ARRAY=$4; next} &lt;BR /&gt;/Device Clar/ {LUN=$5; next} &lt;BR /&gt;/VxVM/ {print CTD, PROD, CAP/1000000, ARRAY, LUN}' \ &lt;BR /&gt;syminq-v-clar &lt;BR /&gt;=============================================&lt;BR /&gt;&lt;BR /&gt;regards!</description>
      <pubDate>Mon, 22 Aug 2005 11:14:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919976#M104306</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2005-08-22T11:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: awk question:  Change /dev/dsk/c101t2d4 -&gt; c101t2d4</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919977#M104307</link>
      <description>oops that probably should be a[4] instead of a[3], but you could figure that out.&lt;BR /&gt;&lt;BR /&gt;sandman, nice syntax to get the last field.  i'll have to write that one done.</description>
      <pubDate>Mon, 22 Aug 2005 11:18:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919977#M104307</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2005-08-22T11:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: awk question:  Change /dev/dsk/c101t2d4 -&gt; c101t2d4</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919978#M104308</link>
      <description>You can do &lt;BR /&gt;'{print substr(CTD,y,z)}'</description>
      <pubDate>Mon, 22 Aug 2005 11:23:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919978#M104308</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2005-08-22T11:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: awk question:  Change /dev/dsk/c101t2d4 -&gt; c101t2d4</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919979#M104309</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;you can pipe the output into :&lt;BR /&gt;sed -e "s/\/dev\/rdsk\///"&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Jean-Luc</description>
      <pubDate>Mon, 22 Aug 2005 12:34:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919979#M104309</guid>
      <dc:creator>Jean-Luc Oudart</dc:creator>
      <dc:date>2005-08-22T12:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: awk question:  Change /dev/dsk/c101t2d4 -&gt; c101t2d4</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919980#M104310</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;There is always several solutions, for this specific problem I would use the gsub function in awk as recommended by Clay. But, another method that I have often used with awk scripts is to pre-process the file before piping it to awk. In your case, you can translate the "/" to " " (using the tr command) and then "print $NF" in awk.</description>
      <pubDate>Mon, 22 Aug 2005 13:41:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919980#M104310</guid>
      <dc:creator>Leif Halvarsson_2</dc:creator>
      <dc:date>2005-08-22T13:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: awk question:  Change /dev/dsk/c101t2d4 -&gt; c101t2d4</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919981#M104311</link>
      <description>Rather than use awk or cut to eliminate the leading directories, you can use the command designed to do this:&lt;BR /&gt; &lt;BR /&gt;DEVFILE=/dev/rdsk/c101t5d3&lt;BR /&gt;DISK=$(basename $DEVFILE)&lt;BR /&gt; &lt;BR /&gt;Or better yet, let the shell do the stripping:&lt;BR /&gt; &lt;BR /&gt;DISK=${DEVFILE##*/}</description>
      <pubDate>Mon, 22 Aug 2005 20:40:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919981#M104311</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2005-08-22T20:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: awk question:  Change /dev/dsk/c101t2d4 -&gt; c101t2d4</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919982#M104312</link>
      <description>I used "substr", but "split" would also do it.  Thanks all.</description>
      <pubDate>Tue, 23 Aug 2005 08:36:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-question-change-dev-dsk-c101t2d4-gt-c101t2d4/m-p/4919982#M104312</guid>
      <dc:creator>Stuart Abramson</dc:creator>
      <dc:date>2005-08-23T08:36:13Z</dc:date>
    </item>
  </channel>
</rss>

