The UNIX and Linux Forums  


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



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Checking if a file exists gugs Shell Programming and Scripting 4 07-23-2008 12:42 PM
Need to write a script in UNIX to find a file if another file exists mmdawg Shell Programming and Scripting 1 05-04-2008 11:40 PM
Check File Exists and compare to previous day file script rbknisely Shell Programming and Scripting 3 02-07-2008 11:53 AM
File exists with Permissions Jose Miguel Shell Programming and Scripting 2 04-16-2007 01:07 PM
File exists and is empty dstinsman UNIX for Dummies Questions & Answers 5 02-09-2006 11:05 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 12-11-2008
kamathg kamathg is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 43
File exists routine

Hello experts,

I need some help here..

I've written the following routine to check for existence of files. The routine does the following. It will look for a compressed ( .Z ) file and if it exists, then it will uncompress it, if it is already uncompressed, then it will just diplay a message saying "Already compressed" or else it will display the message saying "File doesn't exist". But I am sort of doing into infinite loop here.. Output below. Please can you help ? Your help is really appreciated.


uncompress () {

PARFILE=/gbwaaposoa2q4/ora01/app/oracle/orajobs/metadata
cat ${PARFILE} | while read line
do
TABNAME=`echo $line | awk '{print $1}'`
PART=`echo $line | awk '{print $2}'`
REF=`echo $line | awk '{print $3}'`

echo "Table name is ${TABNAME}"
echo "partition name is ${PART}"
echo "Business ref is ${REF}"

DMPFILE=${TABNAME}_PRT_${PART}.dmp
echo "exp dir is $EXPDIR "
cd ${EXPDIR}
if [ -f ${EXPDIR}/${DMPFILE}.Z ]; then
uncompress ${DMPFILE}.Z
elif [ -f ${EXPDIR}/${DMPFILE}]; then
echoLog "Dump file ${DMPFILE} exists on disk. Already uncompressed. "
else
echoLog "Dump file ${DMPFILE} does not exist. "
fi
done
}


My PARFILE is as below

QSFQ1> more metadata
SOACOE_LOGGER_SUMMARY 24112008 'CoPeRSender_v1.2.0:SalesEntity_ID=160598319'
SOACOE_AUDIT 24112008 'CoPeRSender_v1.2.0:SalesEntity_ID=160598319'
SOACOE_AUDIT 01122008 'S3DSenderESCP_v1.2.0:MsgId=1155460108'
SOACOE_AUDIT 24112008 'CoPeRSender_v1.2.0:Organization_CoPeR_ID=163823082'
SOACOE_AUDIT 24112008 'CoPeRSender_v1.2.0:SalesEntity_ID=165751555'
SOACOE_AUDIT 24112008 'CoPeRSender_v1.2.0:Organization_CoPeR_ID=200324'
SOACOE_AUDIT 24112008 'CoPeRSender_v1.2.0:Organization_CoPeR_ID=608834'
SOACOE_LOGGER_SUMMARY 24112008 'CoPeRSender_v1.2.0:Organization_CoPeR_ID=163823082'
SOACOE_LOGGER_SUMMARY 24112008 'CoPeRSender_v1.2.0:SalesEntity_ID=165751555'
SOACOE_LOGGER_SUMMARY 24112008 'CoPeRSender_v1.2.0:Organization_CoPeR_ID=200324'
SOACOE_LOGGER_SUMMARY 24112008 'CoPeRSender_v1.2.0:Organization_CoPeR_ID=608834'



I get the following output when i run this..

./restore_data.ksh[188]: [: missing ]
08:40:04 Dump file SOACOE_LOGGER_SUMMARY_PRT_24112008.dmp does not exist.
Table name is SOACOE_AUDIT
partition name is 24112008
Business ref is 'CoPeRSender_v1.2.0:SalesEntity_ID=160598319'
exp dir is /tmp
Table name is SOACOE_LOGGER_SUMMARY
partition name is 24112008
Business ref is 'CoPeRSender_v1.2.0:SalesEntity_ID=160598319'
exp dir is /tmp
./restore_data.ksh[188]: [: missing ]
08:40:04 Dump file SOACOE_LOGGER_SUMMARY_PRT_24112008.dmp does not exist.
Table name is SOACOE_AUDIT
partition name is 24112008
Business ref is 'CoPeRSender_v1.2.0:SalesEntity_ID=160598319'
exp dir is /tmp
Table name is SOACOE_LOGGER_SUMMARY
partition name is 24112008
Business ref is 'CoPeRSender_v1.2.0:SalesEntity_ID=160598319'
exp dir is /tmp
./restore_data.ksh[188]: [: missing ]
08:40:04 Dump file SOACOE_LOGGER_SUMMARY_PRT_24112008.dmp does not exist.
Table name is SOACOE_AUDIT
partition name is 24112008
Business ref is 'CoPeRSender_v1.2.0:SalesEntity_ID=160598319'
exp dir is /tmp
Table name is SOACOE_LOGGER_SUMMARY
partition name is 24112008
Business ref is 'CoPeRSender_v1.2.0:SalesEntity_ID=160598319'
exp dir is /tmp
./restore_data.ksh[188]: [: missing ]
08:40:04 Dump file SOACOE_LOGGER_SUMMARY_PRT_24112008.dmp does not exist.
Table name is SOACOE_AUDIT
partition name is 24112008
Business ref is 'CoPeRSender_v1.2.0:SalesEntity_ID=160598319'
exp dir is /tmp
Table name is SOACOE_LOGGER_SUMMARY
partition name is 24112008
Business ref is 'CoPeRSender_v1.2.0:SalesEntity_ID=160598319'
exp dir is /tmp





Thanks for your help in advance.

G
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:33 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0