<?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: Variable syntax in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/variable-syntax/m-p/4926180#M104828</link>
    <description>Hi Dave:&lt;BR /&gt;&lt;BR /&gt;If you prefer, one way in perl could be:&lt;BR /&gt;&lt;BR /&gt;# perl -le '$str=shift;$FH=shift;open FH;while (&lt;FH&gt;) {@fields=split;print $fields[1] if /$str\s+/'} ${VGNAME}/${LVNAME} /etc/fstab&lt;BR /&gt;&lt;BR /&gt;...where you pass the argument you seek to match followed by the filename you want to examine -- /etc/fstab or perhaps /etc/mnttab.&lt;BR /&gt;&lt;BR /&gt;Since perl fields are 0-relative, whereas 'awk' numbers from one (1) the perl snippet above references the same field that your 'awk' does.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;/FH&gt;</description>
    <pubDate>Wed, 14 Sep 2005 19:58:25 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2005-09-14T19:58:25Z</dc:date>
    <item>
      <title>Variable syntax</title>
      <link>https://community.hpe.com/t5/operating-system-linux/variable-syntax/m-p/4926178#M104826</link>
      <description>&lt;BR /&gt;I am having trouble figuring out to reference two variables together&lt;BR /&gt;&lt;BR /&gt;for example&lt;BR /&gt;&lt;BR /&gt;grep $VGNAME/$LVNAME /etc/fstab |awk '{print$2}'&lt;BR /&gt;&lt;BR /&gt;returns /vg01/lvol1&lt;BR /&gt;        /vg01/lvol11&lt;BR /&gt;        /vg01/lvol12&lt;BR /&gt;&lt;BR /&gt;How do I bracket the $VGNAME/$LVNAME to get the exact match?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Dave</description>
      <pubDate>Wed, 14 Sep 2005 18:43:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/variable-syntax/m-p/4926178#M104826</guid>
      <dc:creator>DCE</dc:creator>
      <dc:date>2005-09-14T18:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: Variable syntax</title>
      <link>https://community.hpe.com/t5/operating-system-linux/variable-syntax/m-p/4926179#M104827</link>
      <description>Hi Dave:&lt;BR /&gt;&lt;BR /&gt;Enclose the expression in double quotes.  Note the trailing space after ${LVNAME}.&lt;BR /&gt;&lt;BR /&gt;It is also best to use curly braces around variable names.&lt;BR /&gt;&lt;BR /&gt;# grep "${VGNAME}/${LVNAME} " /etc/fstab | awk '{print $2}'&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 14 Sep 2005 18:50:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/variable-syntax/m-p/4926179#M104827</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2005-09-14T18:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: Variable syntax</title>
      <link>https://community.hpe.com/t5/operating-system-linux/variable-syntax/m-p/4926180#M104828</link>
      <description>Hi Dave:&lt;BR /&gt;&lt;BR /&gt;If you prefer, one way in perl could be:&lt;BR /&gt;&lt;BR /&gt;# perl -le '$str=shift;$FH=shift;open FH;while (&lt;FH&gt;) {@fields=split;print $fields[1] if /$str\s+/'} ${VGNAME}/${LVNAME} /etc/fstab&lt;BR /&gt;&lt;BR /&gt;...where you pass the argument you seek to match followed by the filename you want to examine -- /etc/fstab or perhaps /etc/mnttab.&lt;BR /&gt;&lt;BR /&gt;Since perl fields are 0-relative, whereas 'awk' numbers from one (1) the perl snippet above references the same field that your 'awk' does.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;/FH&gt;</description>
      <pubDate>Wed, 14 Sep 2005 19:58:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/variable-syntax/m-p/4926180#M104828</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2005-09-14T19:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: Variable syntax</title>
      <link>https://community.hpe.com/t5/operating-system-linux/variable-syntax/m-p/4926181#M104829</link>
      <description>Thanks!&lt;BR /&gt;&lt;BR /&gt;Dave</description>
      <pubDate>Wed, 14 Sep 2005 21:01:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/variable-syntax/m-p/4926181#M104829</guid>
      <dc:creator>DCE</dc:creator>
      <dc:date>2005-09-14T21:01:13Z</dc:date>
    </item>
  </channel>
</rss>

