<?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: Processing directory structures in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/processing-directory-structures/m-p/3835396#M100650</link>
    <description>&lt;!--!*#--&gt;imho...modify the find command instead of parsing the list of directories i.e.&lt;BR /&gt;&lt;BR /&gt;change...&lt;BR /&gt;&lt;BR /&gt;FromDirNames=`find ${SCRIPT_DIR}/OB -type d | tail +2 | sed 's,'${SCRIPT_DIR}'/OB/,,'`&lt;BR /&gt;&lt;BR /&gt;to...&lt;BR /&gt;&lt;BR /&gt;FromDirNames=`find ${SCRIPT_DIR}/OB ! -path "${SCRIPT_DIR}/OB/*/SID/*"   -type d | tail +2 | sed 's,'${SCRIPT_DIR}'/OB/,,'`</description>
    <pubDate>Tue, 01 Aug 2006 18:06:16 GMT</pubDate>
    <dc:creator>Sandman!</dc:creator>
    <dc:date>2006-08-01T18:06:16Z</dc:date>
    <item>
      <title>Processing directory structures</title>
      <link>https://community.hpe.com/t5/operating-system-linux/processing-directory-structures/m-p/3835391#M100645</link>
      <description>&lt;!--!*#--&gt;I need some help processing directory structures.  I have an environment variable which contains the following (example):&lt;BR /&gt;&lt;BR /&gt;admin/sql&lt;BR /&gt;admin/bin&lt;BR /&gt;admin/SID&lt;BR /&gt;admin/SID/adump&lt;BR /&gt;admin/SID/bdump&lt;BR /&gt;admin/log&lt;BR /&gt;archive&lt;BR /&gt;archive/SID&lt;BR /&gt;archive/SID/dmp&lt;BR /&gt;&lt;BR /&gt;I want to process (actually build a "cp -R" command) for those entries that do not contain SID or those that contain SID but only as the last word.  I don't want to process the entries that contain SID but have something after it (e.g. - SID/dmp).&lt;BR /&gt;&lt;BR /&gt;My current code is attached.  I'm not sure how to check for the last condition of something after SID.&lt;BR /&gt;&lt;BR /&gt;I would imagine there is also probably a better way of handling the from and to directories so that I don't have to use 2 variables.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance for your help.&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Tue, 01 Aug 2006 16:35:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/processing-directory-structures/m-p/3835391#M100645</guid>
      <dc:creator>Steve Givens</dc:creator>
      <dc:date>2006-08-01T16:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Processing directory structures</title>
      <link>https://community.hpe.com/t5/operating-system-linux/processing-directory-structures/m-p/3835392#M100646</link>
      <description>Shalom Steve,&lt;BR /&gt;&lt;BR /&gt;Nice name.&lt;BR /&gt;&lt;BR /&gt;Your code crashes my browser so I can't look.&lt;BR /&gt;&lt;BR /&gt;basename&lt;BR /&gt;&lt;BR /&gt;That will isolate the last variable and can be used to extract it into another variabel.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Tue, 01 Aug 2006 16:43:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/processing-directory-structures/m-p/3835392#M100646</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2006-08-01T16:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: Processing directory structures</title>
      <link>https://community.hpe.com/t5/operating-system-linux/processing-directory-structures/m-p/3835393#M100647</link>
      <description>Not sure why the attachment would crash your browser, but here is the code in question:&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;ORACLE_SID=${ORACLE_SID:-\wiltst1} #Default ORACLE_SID&lt;BR /&gt;SCRIPT_DIR=${SCRIPT_DIR:-\/oracle} #Default directory for scripts&lt;BR /&gt;&lt;BR /&gt;FromDirNames=`find ${SCRIPT_DIR}/OB -type d | tail +2 | sed 's,'${SCRIPT_DIR}'/OB/,,'`&lt;BR /&gt;ToDirNames=`echo ${FromDirNames} | sed 's,SID,'${ORACLE_SID}',g'`&lt;BR /&gt; &lt;BR /&gt;echo "\n\nFromDirNames=${FromDirNames}\n"&lt;BR /&gt;echo "\n\nToDirNames=${ToDirNames}\n"&lt;BR /&gt; &lt;BR /&gt;for subdir in ${ToDirNames}&lt;BR /&gt;do&lt;BR /&gt;  if [ -d "${ORACLE_BASE}/$subdir" ] ; then&lt;BR /&gt;    echo "${ORACLE_BASE}/$subdir already exists"&lt;BR /&gt;  else&lt;BR /&gt;    echo "Creating ${ORACLE_BASE}/$subdir"&lt;BR /&gt;    Cmd="cp -R ${SCRIPT_DIR}/OB/$subdir ${ORACLE_BASE}/$subdir"&lt;BR /&gt;    FinalCmd="`echo ${Cmd} | sed 's/'${ORACLE_SID}'/SID/1'`"&lt;BR /&gt;    echo "\t Cmd=${Cmd}"&lt;BR /&gt;    echo "\t FinalCmd=${FinalCmd}"&lt;BR /&gt;  fi&lt;BR /&gt;done       # for subdir loop&lt;BR /&gt;</description>
      <pubDate>Tue, 01 Aug 2006 16:48:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/processing-directory-structures/m-p/3835393#M100647</guid>
      <dc:creator>Steve Givens</dc:creator>
      <dc:date>2006-08-01T16:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: Processing directory structures</title>
      <link>https://community.hpe.com/t5/operating-system-linux/processing-directory-structures/m-p/3835394#M100648</link>
      <description>did you try using grep to weed out the entries you do not want like&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;find ${SCRIPT_DIR}/OB -type d | grep -v SID$&lt;BR /&gt;&lt;BR /&gt;this should eliminate tje lines ending with "SID" from the find output.&lt;BR /&gt;</description>
      <pubDate>Tue, 01 Aug 2006 16:53:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/processing-directory-structures/m-p/3835394#M100648</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2006-08-01T16:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: Processing directory structures</title>
      <link>https://community.hpe.com/t5/operating-system-linux/processing-directory-structures/m-p/3835395#M100649</link>
      <description>Hi Steve:&lt;BR /&gt;&lt;BR /&gt;Given that you have a variable loaded with (space-delimited) directories, like:&lt;BR /&gt;&lt;BR /&gt;# echo ${VAR}&lt;BR /&gt;admin/sql admin/bin admin/SID admin/SID/adump admin/SID/bdump admin/log archive &lt;BR /&gt;archive/SID archive/SID/dmp&lt;BR /&gt;&lt;BR /&gt;# echo ${VAR}|perl -nle '@a=split / /;for (@a) {print if m%/SID\z%;print unless m%SID%}'&lt;BR /&gt;&lt;BR /&gt;...will yield:&lt;BR /&gt;&lt;BR /&gt;admin/sql&lt;BR /&gt;admin/bin&lt;BR /&gt;admin/SID&lt;BR /&gt;admin/log&lt;BR /&gt;archive&lt;BR /&gt;archive/SID&lt;BR /&gt;&lt;BR /&gt;...You could capture this output too:&lt;BR /&gt;&lt;BR /&gt;# NEWVAR=`echo ${VAR}|perl -nle '@a=split / /;for (@a) {print if m%/SID\z%;print unless m%SID%}'`&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 01 Aug 2006 17:16:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/processing-directory-structures/m-p/3835395#M100649</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-08-01T17:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: Processing directory structures</title>
      <link>https://community.hpe.com/t5/operating-system-linux/processing-directory-structures/m-p/3835396#M100650</link>
      <description>&lt;!--!*#--&gt;imho...modify the find command instead of parsing the list of directories i.e.&lt;BR /&gt;&lt;BR /&gt;change...&lt;BR /&gt;&lt;BR /&gt;FromDirNames=`find ${SCRIPT_DIR}/OB -type d | tail +2 | sed 's,'${SCRIPT_DIR}'/OB/,,'`&lt;BR /&gt;&lt;BR /&gt;to...&lt;BR /&gt;&lt;BR /&gt;FromDirNames=`find ${SCRIPT_DIR}/OB ! -path "${SCRIPT_DIR}/OB/*/SID/*"   -type d | tail +2 | sed 's,'${SCRIPT_DIR}'/OB/,,'`</description>
      <pubDate>Tue, 01 Aug 2006 18:06:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/processing-directory-structures/m-p/3835396#M100650</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-08-01T18:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: Processing directory structures</title>
      <link>https://community.hpe.com/t5/operating-system-linux/processing-directory-structures/m-p/3835397#M100651</link>
      <description>I knew I'd have a Perl fan respond to this, so thanks.&lt;BR /&gt;&lt;BR /&gt;What I'm working on is a deployment script that needs to run on any environment.  Right now I just need to worry about Sun, AIX and HP-UX.  Any concerns with Perl compatibility?</description>
      <pubDate>Fri, 04 Aug 2006 11:43:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/processing-directory-structures/m-p/3835397#M100651</guid>
      <dc:creator>Steve Givens</dc:creator>
      <dc:date>2006-08-04T11:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: Processing directory structures</title>
      <link>https://community.hpe.com/t5/operating-system-linux/processing-directory-structures/m-p/3835398#M100652</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;ANY environment - you are really aiming high :-)&lt;BR /&gt;&lt;BR /&gt;But the UNIXs you mentioned&lt;BR /&gt;- as long as only such one liners are in play, they can be adopted to ANY perl-version&lt;BR /&gt;- as long as these OSs are in play, recent perl distributions of the same perl version are found at&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://activestate.com" target="_blank"&gt;http://activestate.com&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Fri, 04 Aug 2006 11:54:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/processing-directory-structures/m-p/3835398#M100652</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-08-04T11:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: Processing directory structures</title>
      <link>https://community.hpe.com/t5/operating-system-linux/processing-directory-structures/m-p/3835399#M100653</link>
      <description>Mel, actually I'm trying to do the opposite - keep lines with no SID in it and lines that end in SID.&lt;BR /&gt;&lt;BR /&gt;Sandman, your syntax is not working for me:&lt;BR /&gt;"-path is not a valid option".  Is that not supported on AIX?</description>
      <pubDate>Fri, 04 Aug 2006 15:49:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/processing-directory-structures/m-p/3835399#M100653</guid>
      <dc:creator>Steve Givens</dc:creator>
      <dc:date>2006-08-04T15:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: Processing directory structures</title>
      <link>https://community.hpe.com/t5/operating-system-linux/processing-directory-structures/m-p/3835400#M100654</link>
      <description>Hi Steve:&lt;BR /&gt;&lt;BR /&gt;No, the '-path' switch is not valid with AIX's 'find'.  If you want easy portability, you want Perl.&lt;BR /&gt;&lt;BR /&gt;Using Perl, you could leverage the 'File::Find' core module if you want.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 04 Aug 2006 15:59:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/processing-directory-structures/m-p/3835400#M100654</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-08-04T15:59:35Z</dc:date>
    </item>
  </channel>
</rss>

