40 pts.
 How to append .log extention after unzip a file
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

Software/Hardware used:
ASKED: December 19, 2009  3:41 PM
UPDATED: December 24, 2009  1:18 PM

Answer Wiki:
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
Last Wiki Answer Submitted:  December 21, 2009  4:45 pm  by  Twiki   40 pts.
All Answer Wiki Contributors:  Twiki   40 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

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.

 63,580 pts.

 

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 pts.

 

That’s a Unix script. How are you implementing that on windows ?

 63,580 pts.

 

I execute the script through CYGWIN

 40 pts.