<?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 Checking file contents in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-file-contents/m-p/2736054#M836995</link>
    <description>HI &lt;BR /&gt;&lt;BR /&gt;I have the following 2 files, which is the form:&lt;BR /&gt;#cat f1&lt;BR /&gt;/fs12/nwd.cr.24&lt;BR /&gt;/fs12/nwd.des.mem&lt;BR /&gt;/fs13/nwd.fclk.45&lt;BR /&gt;/fs14/nwd.cr.256&lt;BR /&gt;/fs37/nwd.srtl.pv&lt;BR /&gt;&lt;BR /&gt;#cat f2&lt;BR /&gt;/fs12/nwd.cr.24&lt;BR /&gt;/fs12/nwd.des.mem&lt;BR /&gt;/fs11/nwd.shark.pv&lt;BR /&gt;/fs36/nwd.srtl.rtl&lt;BR /&gt;/fs37/nwd.srtl.pv&lt;BR /&gt;&lt;BR /&gt;whereby files f1 and f2 contains lists of filesystems residing on 2 remote machines, A and B respectively.&lt;BR /&gt;&lt;BR /&gt;I was wondering, how do I read the contents of these files, and place them into 2 seperate arrays in Bourne/C-shell? &lt;BR /&gt;&lt;BR /&gt;I would like to compare every index of the 2 arrays to see if they are similar. If similar, then I would like to rcp them from machine A into machine B, else do nothing. &lt;BR /&gt;&lt;BR /&gt;Can someone help me out in this matter?&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 03 Jun 2002 05:02:18 GMT</pubDate>
    <dc:creator>Chern Jian Leaw</dc:creator>
    <dc:date>2002-06-03T05:02:18Z</dc:date>
    <item>
      <title>Checking file contents</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-file-contents/m-p/2736054#M836995</link>
      <description>HI &lt;BR /&gt;&lt;BR /&gt;I have the following 2 files, which is the form:&lt;BR /&gt;#cat f1&lt;BR /&gt;/fs12/nwd.cr.24&lt;BR /&gt;/fs12/nwd.des.mem&lt;BR /&gt;/fs13/nwd.fclk.45&lt;BR /&gt;/fs14/nwd.cr.256&lt;BR /&gt;/fs37/nwd.srtl.pv&lt;BR /&gt;&lt;BR /&gt;#cat f2&lt;BR /&gt;/fs12/nwd.cr.24&lt;BR /&gt;/fs12/nwd.des.mem&lt;BR /&gt;/fs11/nwd.shark.pv&lt;BR /&gt;/fs36/nwd.srtl.rtl&lt;BR /&gt;/fs37/nwd.srtl.pv&lt;BR /&gt;&lt;BR /&gt;whereby files f1 and f2 contains lists of filesystems residing on 2 remote machines, A and B respectively.&lt;BR /&gt;&lt;BR /&gt;I was wondering, how do I read the contents of these files, and place them into 2 seperate arrays in Bourne/C-shell? &lt;BR /&gt;&lt;BR /&gt;I would like to compare every index of the 2 arrays to see if they are similar. If similar, then I would like to rcp them from machine A into machine B, else do nothing. &lt;BR /&gt;&lt;BR /&gt;Can someone help me out in this matter?&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 03 Jun 2002 05:02:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/checking-file-contents/m-p/2736054#M836995</guid>
      <dc:creator>Chern Jian Leaw</dc:creator>
      <dc:date>2002-06-03T05:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: Checking file contents</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-file-contents/m-p/2736055#M836996</link>
      <description>Hi Chern,&lt;BR /&gt;&lt;BR /&gt;you can put the output of any command as value into a variable using command substitution:&lt;BR /&gt;&lt;BR /&gt;array[0]=`cat f1`&lt;BR /&gt;array[1]=`cat f2`&lt;BR /&gt;&lt;BR /&gt;After this, you can compare the output of your cat- command or whatever you want to do.&lt;BR /&gt;&lt;BR /&gt;Allways stay on the bright side of life!&lt;BR /&gt;&lt;BR /&gt;Peter</description>
      <pubDate>Mon, 03 Jun 2002 06:03:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/checking-file-contents/m-p/2736055#M836996</guid>
      <dc:creator>Peter Kloetgen</dc:creator>
      <dc:date>2002-06-03T06:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: Checking file contents</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-file-contents/m-p/2736056#M836997</link>
      <description>Peter,&lt;BR /&gt;&lt;BR /&gt;Does the statement array[0]='cat f1' places the entire entries/contents of the file f1 into array[0]? &lt;BR /&gt;&lt;BR /&gt;So how do I compare each of the contents/entries of file f2, which is placed into array[1]? &lt;BR /&gt;&lt;BR /&gt;I would like to have 2 seperate arrays, each holding the entries of files f1 and f2 respectively. &lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Mon, 03 Jun 2002 06:11:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/checking-file-contents/m-p/2736056#M836997</guid>
      <dc:creator>Chern Jian Leaw</dc:creator>
      <dc:date>2002-06-03T06:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: Checking file contents</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-file-contents/m-p/2736057#M836998</link>
      <description>Hi Chern,&lt;BR /&gt;&lt;BR /&gt;please use backticks for the command substitution to get it work. Then the answer is YES, the output of your cat- command ist put into an array. If you want to put single lines into variables, you need a loop construction for this. The awk- command can help you here.&lt;BR /&gt;&lt;BR /&gt;Allways stay on the bright side of life!&lt;BR /&gt;&lt;BR /&gt;Peter</description>
      <pubDate>Mon, 03 Jun 2002 06:32:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/checking-file-contents/m-p/2736057#M836998</guid>
      <dc:creator>Peter Kloetgen</dc:creator>
      <dc:date>2002-06-03T06:32:09Z</dc:date>
    </item>
    <item>
      <title>Re: Checking file contents</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-file-contents/m-p/2736058#M836999</link>
      <description>Hi Chern,&lt;BR /&gt;&lt;BR /&gt;Try this&lt;BR /&gt;integer num=0&lt;BR /&gt;for i in `cat f1`&lt;BR /&gt;do&lt;BR /&gt;array[$num]=$i&lt;BR /&gt;(( num = $num + 1 ))&lt;BR /&gt;done&lt;BR /&gt;integer num2=0&lt;BR /&gt;for i in `cat f2`&lt;BR /&gt;do&lt;BR /&gt;array2[$num2]=$i&lt;BR /&gt;(( num2 = $num2 + 1 ))&lt;BR /&gt;done&lt;BR /&gt;sw=ok&lt;BR /&gt;integer F=0&lt;BR /&gt;for i in ${array[@]}&lt;BR /&gt;do&lt;BR /&gt;  if [ ${array[$F]} = ${array2[$F]} ]&lt;BR /&gt;  then&lt;BR /&gt;    ok=ok&lt;BR /&gt;  else&lt;BR /&gt;    ok=nook&lt;BR /&gt;    exit;&lt;BR /&gt;  fi&lt;BR /&gt;(( F = $F + 1 ))&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;if [ $ok = "ok" ]&lt;BR /&gt;then&lt;BR /&gt;  echo " are the same copying"&lt;BR /&gt;  integer F1=0&lt;BR /&gt;  for i in ${array[@]}&lt;BR /&gt;  do&lt;BR /&gt;    rcp hosta:${array[$F1]} hostb:${array2[$F1]}&lt;BR /&gt;  (( F1 = $F1 + 1 ))&lt;BR /&gt;   done&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Hope this helps&lt;BR /&gt;&lt;BR /&gt;Justo.</description>
      <pubDate>Mon, 03 Jun 2002 06:44:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/checking-file-contents/m-p/2736058#M836999</guid>
      <dc:creator>Justo Exposito</dc:creator>
      <dc:date>2002-06-03T06:44:20Z</dc:date>
    </item>
  </channel>
</rss>

