<?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 need help with shell script for array and loop processing files in Operating System - Tru64 Unix</title>
    <link>https://community.hpe.com/t5/operating-system-tru64-unix/need-help-with-shell-script-for-array-and-loop-processing-files/m-p/3442548#M3853</link>
    <description>I have a ton of database files that I want to parse and send to report text files. Currently we are using diffs to extract the information but would like to move this to a simpler method. I need create an array of all the files to loop thru and take a diff of the files&lt;BR /&gt;write the output to a .txt flat file in unix.&lt;BR /&gt;&lt;BR /&gt;what I have thus far: (old script)&lt;BR /&gt;&lt;BR /&gt;diff ${REPORT_DIR}_db_dy_${ORACLE_SID}_a.dat ${REPORT_DIR}_db_dy_${ORACLE_SID}_b.dat &amp;gt; diffs.txt&lt;BR /&gt;&lt;BR /&gt;I want to take these about 100 of these files and make an array and process all 100 of them in a ksh loop to separate reports in flat files. Can anyone help me with how to do this in a ksh script? Thanks!!</description>
    <pubDate>Mon, 13 Dec 2004 16:36:08 GMT</pubDate>
    <dc:creator>Ben_181</dc:creator>
    <dc:date>2004-12-13T16:36:08Z</dc:date>
    <item>
      <title>need help with shell script for array and loop processing files</title>
      <link>https://community.hpe.com/t5/operating-system-tru64-unix/need-help-with-shell-script-for-array-and-loop-processing-files/m-p/3442548#M3853</link>
      <description>I have a ton of database files that I want to parse and send to report text files. Currently we are using diffs to extract the information but would like to move this to a simpler method. I need create an array of all the files to loop thru and take a diff of the files&lt;BR /&gt;write the output to a .txt flat file in unix.&lt;BR /&gt;&lt;BR /&gt;what I have thus far: (old script)&lt;BR /&gt;&lt;BR /&gt;diff ${REPORT_DIR}_db_dy_${ORACLE_SID}_a.dat ${REPORT_DIR}_db_dy_${ORACLE_SID}_b.dat &amp;gt; diffs.txt&lt;BR /&gt;&lt;BR /&gt;I want to take these about 100 of these files and make an array and process all 100 of them in a ksh loop to separate reports in flat files. Can anyone help me with how to do this in a ksh script? Thanks!!</description>
      <pubDate>Mon, 13 Dec 2004 16:36:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-tru64-unix/need-help-with-shell-script-for-array-and-loop-processing-files/m-p/3442548#M3853</guid>
      <dc:creator>Ben_181</dc:creator>
      <dc:date>2004-12-13T16:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: need help with shell script for array and loop processing files</title>
      <link>https://community.hpe.com/t5/operating-system-tru64-unix/need-help-with-shell-script-for-array-and-loop-processing-files/m-p/3442549#M3854</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;no need to use arrays for this.&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;rm diffs.txt&lt;BR /&gt;SIDLIST="SID1 SID2 ... SID100"&lt;BR /&gt;for SID in ${SIDLIST}&lt;BR /&gt;do&lt;BR /&gt;  diff ${REPORT_DIR}_db_dy_${ORACLE_SID}_a.dat ${REPORT_DIR}_db_dy_${ORACLE_SID}_b.dat &amp;gt;&amp;gt; diffs.txt&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Mon, 13 Dec 2004 16:42:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-tru64-unix/need-help-with-shell-script-for-array-and-loop-processing-files/m-p/3442549#M3854</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2004-12-13T16:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: need help with shell script for array and loop processing files</title>
      <link>https://community.hpe.com/t5/operating-system-tru64-unix/need-help-with-shell-script-for-array-and-loop-processing-files/m-p/3442550#M3855</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;hit the button too early. That should have been&lt;BR /&gt;diff ${REPORT_DIR}_db_dy_${SID}_a.dat ${REPORT_DIR}_db_dy_${SID}_b.dat &amp;gt; diffs.txt&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Mon, 13 Dec 2004 16:44:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-tru64-unix/need-help-with-shell-script-for-array-and-loop-processing-files/m-p/3442550#M3855</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2004-12-13T16:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: need help with shell script for array and loop processing files</title>
      <link>https://community.hpe.com/t5/operating-system-tru64-unix/need-help-with-shell-script-for-array-and-loop-processing-files/m-p/3442551#M3856</link>
      <description>Thanks. Actually my goal is to streamline the whole process so that if we add another script to run a report against I can just add it to the array stack without adding another messy diff command.&lt;BR /&gt;&lt;BR /&gt;example:&lt;BR /&gt;&lt;BR /&gt;diff ${REPORT_DIR}r${YESTERDAY}_db_dy_${ORACLE_SID}_report1.dat&lt;BR /&gt; ${REPORT_DIR}r${TODAY}_db_dy_${ORACLE_SID}_report2.dat&lt;BR /&gt;&amp;gt;${REPORT_DIR}r${TODAY}_db_dy_${ORACLE_SID}_diffs.dat&lt;BR /&gt;&lt;BR /&gt;-- echo reports to files&lt;BR /&gt;echo "${ORACLE_SID} RESULTS FOR ${TODAY}"&amp;gt;${REPORT_DIR}r${TODAY}_db_dy_${ORACLE_SID}_diffrepots.txt&lt;BR /&gt;&lt;BR /&gt;As you can see when you have 100 of these diff files and need to echo them to a flat file the shell script gets very messy and confusing! I want to clean the logic up by using an array in a loop so that when a new batch of files are added I just add a new array member to the stack. Thank you very much!</description>
      <pubDate>Mon, 13 Dec 2004 16:52:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-tru64-unix/need-help-with-shell-script-for-array-and-loop-processing-files/m-p/3442551#M3856</guid>
      <dc:creator>Ben_181</dc:creator>
      <dc:date>2004-12-13T16:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: need help with shell script for array and loop processing files</title>
      <link>https://community.hpe.com/t5/operating-system-tru64-unix/need-help-with-shell-script-for-array-and-loop-processing-files/m-p/3442552#M3857</link>
      <description>Ben,&lt;BR /&gt;&lt;BR /&gt;in case you did not notice, I was ruuning a for loop. I have only one diff.&lt;BR /&gt;But if you want an array, that is no problem.&lt;BR /&gt;You use arrays like&lt;BR /&gt;SIDLIST[0]="sid1"&lt;BR /&gt;They have one index, are created automatically and can hold up to 1023 members.&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Mon, 13 Dec 2004 18:23:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-tru64-unix/need-help-with-shell-script-for-array-and-loop-processing-files/m-p/3442552#M3857</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2004-12-13T18:23:11Z</dc:date>
    </item>
  </channel>
</rss>

