<?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: case help in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/case-help/m-p/4140030#M93296</link>
    <description>&lt;!--!*#--&gt;If these are the only 6 valid lines and the spacing is exactly the same and the echo is the same, you can simply grep -vf:&lt;BR /&gt;$ grep -vf valid-output input-file&lt;BR /&gt;&lt;BR /&gt;Of course if you get some output, you'll have to decode it to print an error.  Or you can just print the whole output and say these are the bad lines:&lt;BR /&gt;grep -vf valid-output input-file &amp;gt; bad_file&lt;BR /&gt;if [ -s bad_file ]; then&lt;BR /&gt;   echo "Run Functions"&lt;BR /&gt;   # print or remove bad_file&lt;BR /&gt;fi</description>
    <pubDate>Tue, 05 Feb 2008 08:25:58 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2008-02-05T08:25:58Z</dc:date>
    <item>
      <title>case help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/case-help/m-p/4140027#M93293</link>
      <description>I am creating a module within a script and would like some assistance:&lt;BR /&gt;&lt;BR /&gt;on AIX i run the following command&lt;BR /&gt;&lt;BR /&gt;root@tstestcl.eu.unilever.com # sysdumpdev -l&lt;BR /&gt;primary              /dev/lg_dumplv&lt;BR /&gt;secondary            /dev/lg_dumplv2&lt;BR /&gt;copy directory       /var/adm/ras&lt;BR /&gt;forced copy flag     TRUE&lt;BR /&gt;always allow dump    TRUE&lt;BR /&gt;dump compression     ON&lt;BR /&gt;&lt;BR /&gt;this is the correct output on this system however it is not the case on all systems and I have over 1000 systems to check ....&lt;BR /&gt;&lt;BR /&gt;I was going to use $1 to provide the string for the case statement&lt;BR /&gt;&lt;BR /&gt;case $1 in&lt;BR /&gt;&lt;BR /&gt;primary )&lt;BR /&gt;&lt;BR /&gt;        if [[ $2 = /dev/lg_dumplv ]] ; then&lt;BR /&gt;&lt;BR /&gt;                continue&lt;BR /&gt;        else&lt;BR /&gt;                echo "Run Funtions"&lt;BR /&gt;        fi&lt;BR /&gt;;;&lt;BR /&gt;&lt;BR /&gt;secondary )&lt;BR /&gt;&lt;BR /&gt;        if [[ $2 = /dev/lg_dumplv2 ]] ; then&lt;BR /&gt;&lt;BR /&gt;                continue&lt;BR /&gt;        else&lt;BR /&gt;                echo "Run Funtions"&lt;BR /&gt;        fi&lt;BR /&gt;;;&lt;BR /&gt;&lt;BR /&gt;copy )&lt;BR /&gt;&lt;BR /&gt;        if [[ $2 = /var/adm/ras ]] ; then&lt;BR /&gt;&lt;BR /&gt;                continue&lt;BR /&gt;        else&lt;BR /&gt;                echo "Run Funtions"&lt;BR /&gt;        fi&lt;BR /&gt;;;&lt;BR /&gt;&lt;BR /&gt;forced )&lt;BR /&gt;&lt;BR /&gt;        if [[ $2 = TRUE ]] ; then&lt;BR /&gt;&lt;BR /&gt;                continue&lt;BR /&gt;        else&lt;BR /&gt;                echo "Run Funtions"&lt;BR /&gt;        fi&lt;BR /&gt;;;&lt;BR /&gt;&lt;BR /&gt;always )&lt;BR /&gt;&lt;BR /&gt;        if [[ $2 = TRUE ]] ; then&lt;BR /&gt;&lt;BR /&gt;                continue&lt;BR /&gt;        else&lt;BR /&gt;                echo "Run Funtions"&lt;BR /&gt;        fi&lt;BR /&gt;;;&lt;BR /&gt;&lt;BR /&gt;dump )&lt;BR /&gt;&lt;BR /&gt;        if [[ $2 = ON ]] ; then&lt;BR /&gt;&lt;BR /&gt;                continue&lt;BR /&gt;        else&lt;BR /&gt;                echo "Run Funtions"&lt;BR /&gt;        fi&lt;BR /&gt;&lt;BR /&gt;from the command out put I can assign $1 to be the first filed and $2 to be the last field however I am having difficutly running this into awk  ..&lt;BR /&gt;&lt;BR /&gt;what would the most effeicient way to have $1 and $NF to be read by the case statement or is there a better solution for this?&lt;BR /&gt;&lt;BR /&gt;thanks again for any help !&lt;BR /&gt;&lt;BR /&gt;Chris.</description>
      <pubDate>Mon, 04 Feb 2008 17:44:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/case-help/m-p/4140027#M93293</guid>
      <dc:creator>lawrenzo</dc:creator>
      <dc:date>2008-02-04T17:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: case help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/case-help/m-p/4140028#M93294</link>
      <description>Hi Chris:&lt;BR /&gt;&lt;BR /&gt;If I understand your objective, you want to parse the command output and pass this to your script using the first and the last fields of each parsed line as the script's $1 and $2 :&lt;BR /&gt;&lt;BR /&gt;# ./myecommand | awk '{print $1,$NF}' | while read A B;do ./myscript ${A} ${B};done&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 04 Feb 2008 18:05:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/case-help/m-p/4140028#M93294</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-02-04T18:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: case help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/case-help/m-p/4140029#M93295</link>
      <description>How about trying the awk construct below. it can be extended to include all the line parsing you need done i.e.&lt;BR /&gt;&lt;BR /&gt;# awk '{if($1=="primary") if($NF!="/dev/lg_dumplv") print "Run Functions"}' file</description>
      <pubDate>Mon, 04 Feb 2008 18:06:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/case-help/m-p/4140029#M93295</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2008-02-04T18:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: case help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/case-help/m-p/4140030#M93296</link>
      <description>&lt;!--!*#--&gt;If these are the only 6 valid lines and the spacing is exactly the same and the echo is the same, you can simply grep -vf:&lt;BR /&gt;$ grep -vf valid-output input-file&lt;BR /&gt;&lt;BR /&gt;Of course if you get some output, you'll have to decode it to print an error.  Or you can just print the whole output and say these are the bad lines:&lt;BR /&gt;grep -vf valid-output input-file &amp;gt; bad_file&lt;BR /&gt;if [ -s bad_file ]; then&lt;BR /&gt;   echo "Run Functions"&lt;BR /&gt;   # print or remove bad_file&lt;BR /&gt;fi</description>
      <pubDate>Tue, 05 Feb 2008 08:25:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/case-help/m-p/4140030#M93296</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-02-05T08:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: case help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/case-help/m-p/4140031#M93297</link>
      <description>ok thanks for the input.&lt;BR /&gt;&lt;BR /&gt;I'll let you know how I get on ...</description>
      <pubDate>Tue, 05 Feb 2008 09:37:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/case-help/m-p/4140031#M93297</guid>
      <dc:creator>lawrenzo</dc:creator>
      <dc:date>2008-02-05T09:37:11Z</dc:date>
    </item>
  </channel>
</rss>

