How to append .log extention after unzip a file

40 pts.
Tags:
File extensions
WinZip
Zip
I have a .gz file,after it is extracted,I need to append .log as the extension for the file - please suggest ASAP - Thanks in Advance
ASKED: December 19, 2009  3:41 PM
UPDATED: December 24, 2009  1:18 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

elif [[ $i =~ $reg3 ]] ; then
base=`basename $i .gz`
dest=`dirname $i`
(cd $dest; /usr/bin/gunzip $base)
if [ -f $dest"/"$base".log" ]
then
olist=$olist” “$dest”/”$base”.log”
else
echo $i” did not produce a log file” >>$LTEST
fi

Here is the script,and implementing on windows environment

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    More details are needed. What's the operating system ? Is this a file you are compressing to distribute ? if so, why don't you assign the 'log' extension to it before compressing it ? The more details you provide, the better chances to get useful responses.
    65,110 pointsBadges:
    report
  • Twiki
    It comes from a different server in the compressed format,my script then need to uncompress and process the file. Implementing these lines on window . elif [[ $i =~ $reg3 ]] ; then base=`basename $i .gz` # get the basic file name dest=`dirname $i` # get the directory path (cd $dest; /usr/bin/gunzip $base) #execute the gz extract command if [ -f $dest"/"$base".log" ] # check if we got log file then olist=$olist" "$dest"/"$base".log" # add the file to the awk file list else echo $i" did not produce a log file" >>$LTEST fi
    40 pointsBadges:
    report
  • carlosdl
    That's a Unix script. How are you implementing that on windows ?
    65,110 pointsBadges:
    report
  • Twiki
    I execute the script through CYGWIN
    40 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following