The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 01-25-2008
whdr02 whdr02 is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 4
Help with cleanup

I am trying to add a unique string to a variable to prevent some name space collisions.

DATAFILE=/u001/app/unica/affinium644/campaign/partitions/limited/tmp/ebf9aaah.t~#
DATETIME=`date +%Y%m%d_%H%M%S`
echo $DATAFILE > tmpnme.txt
sed 's_/_ _g' tmpnme.txt > tmpnme2.txt
DATA=$(cat tmpnme2.txt)
TMPNAME=$(echo $DATA | awk '{print $9}')
TMPNAE2=$(echo ${TMPNAME%.*})
TBLNAME=$(echo ${DATETIME}${TMPNAE2})
rm tmpnme.txt
rm tmpnme2.txt

TBLNAME will be used as the table name and the datafile is unique but I would be just as satisfied to use a random string or something else.

Any help would be appreciated. I am sure this could be done much more efficiently.