3 Replies Latest reply on Sep 15, 2016 7:18 AM by Bill Robinson

    Using a DepotFile in NSH Script

    Richard Sye

      I have a text file stored in the Depot that i would like to use as input for a NSH scriptJob. I have stored the test file as type File in the Depot and vi an NSH session i am able to use "cat" to show the contents of the file but i am not able to do this via the NSH scriptJob.


      is there anything special i have to consider? Please see the simple function i am trying to complete where the path of the DepotFile is passed as a parameter.


      for each serverEntry in `cat $2`; do

          TIJD=`date '+%Y%m%d_%H%M'`

          FQDN=`echo "${serverEntry}" | awk -F, '{print $1}'`

          echo "$FQDN"

          ORG=`echo "${serverEntry}" | awk -F, '{print $2}' | sed 's/ /-/' | tr '[a-z]' '[A-Z]'`

          echo "$ORG"

          BS=`echo "${serverEntry}" | awk -F, '{print $3}' | sed 's/ /-/' | tr '[a-z]' '[A-Z]'`

          echo "$BS"

          BATCH=`echo "${serverEntry}" | awk -F, '{print $4}' | sed 's/ /-/' | tr '[a-z]' '[A-Z]'`

          echo "$BATCH"


          if [ -z $FQDN ]; then

              echo "FQDN field cannot be empty!"

              exit 1


              if [ ! -z $ORG ]; then

                  echo "${FQDN},PULS_ORG,${ORG}" >> /tmp/BulkSPUpdate_${DATE}.csv


              if [ ! -z $BS ]; then

                  echo "${FQDN},PULS_BS,${BS}" >> /tmp/BulkSPUpdate_${DATE}.csv


              if [ ! -z $BATCH ]; then

                  echo "${FQDN},PULS_Batch,${BATCH}" >> /tmp/BulkSPUpdate_${DATE}.csv