2008年10月2日 星期四

Delete Job FIle from System and Disk by KSHELL

#/bin/ksh

##Create Log Directory
if [ -d $HOME/rmdtab ]
then

tempdirname=$HOME/rmdtab/$( date +"%Y%h%d.%H%M%S")
mkdir $tempdirname

else

echo " Directory is not exists !"
exit

fi

tempdirname=$HOME/rmdtab/$( date +"%Y%h%d%H%M%S")
mkdir $tempdirname;

##Get Job File List ,and Sort File List.
setdtab show > $tempdirname/originfile.txt;

#Collect File List ,and Exclude RD Job File List.
grep -v "^[0-3] " $tempdirname/originfile.txt | grep "/eb[1-99]/ebtest/pattern/." |grep -v "/eb[1-99]/ebtest/pattern/RD/."> $tempdirname/2stfile.txt
grep -v "^[0-3] " $tempdirname/originfile.txt | grep -v "/eb[1-99]/ebtest/pattern/." > $tempdirname/notreatfile.txt

#Get Directory Name
cut -d " " -f 2 $tempdirname/2stfile.txt > $tempdirname/sortrawdata.txt

## Read File List File for sortrawdata,and Separator Job File name by space.
temp=" ";
while read myfile; do

temp=$temp$myfile" ";

done < $tempdirname/sortrawdata.txt

##Sort Job File List by Date , Check Job File exists ,and input sortdata.txt.
ls -td $temp > $tempdirname/sortdata.txt;

## Read File List from sortdata.txt ,Delete Job File Directory ,and Remove File List from System.
typeset -i tempindex=1;
tempnum=" ";
var=" ";

#Read Job File from sortdata.txt
exec 3< $tempdirname/sortdata.txt
while read -r mylines <&3;
do

#only delete 20 Job File by sort date.
if [ tempindex -gt 20 ]
then
#Check Job File in Sytem List ,and wait User Response.
tempnum=$tempnum$(grep $mylines $tempdirname/2stfile.txt | cut -d " " -f 1 )" ";
print -n "Delete "$mylines" (Y/N) \n"; read var;
if [ $var = "y" ]
then
echo $tempnum;
#Delete Job File From System and Disk.
setdtab remove $tempnum;
echo $mylines Delete!"
rm -r $mylines;
else
echo $mylines" Not Delete!";
fi
fi
var=" ";
tempindex=tempindex+1;
done

grep -v "^[0-3] " $tempdirname/originfile.txt | grep "/eb[1-99]/ebtest/pattern/RD" > $tempdirname/rdfile.txt

#Delete RD Job FIle.
exec 3< $tempdirname/rdfile.txt
while read -r myliness <&3;
do

if [ tempindex -gt 20 ]
then

tempnum=$tempnum$(grep $myliness $tempdirname/rdfile.txt | cut -d " " -f 1 )" ";
print -n "Delete "$myliness" (Y/N) \n"; read var;
if [ $var = "y" ]
then
echo $tempnum;
setdtab remove $tempnum;
echo $myliness" Delete!"
else
echo $myliness" Not Delete!"
fi
fi
var=" ";
tempindex=tempindex+1;
done


echo $tempnum;

2008年9月19日 星期五

軟體 Bug 的起源...^_^

軟體運行中因為程式本身有錯誤而造成的功能異常、當機...等現象統稱為臭蟲 (Bug), 這名詞是怎樣來的? Software Bug 一詞起源於1945年後期,當時還是真空管電腦的時代,9月9日當天哈佛大學實驗室內的計算機出現了問題,Hopper 女士仔細地檢查過 Mark II 計算機後,發現繼電器上有一隻蛾貼附在上頭,後來他們將這隻蛾拿掉後,貼在工作日誌上頭,此後,我們就開始指稱電腦系統異常為 Bug 了。

2008年9月16日 星期二

Power Point 簡報快速跳頁密技

在簡報模式下,如果你知道你要跳到第幾頁,直接按[頁數]然後按[ENTER]即可。

[Excel]如何創建自定義函數

在 Excel 內建函式中找不到自已想要的函式怎麼辦?事實上我們可以自已建一個,以下是一個簡單的Excel自定義函數示例,用於將民國年轉為西元: Function 民國轉西元(x As Double) As Double     民國轉西元 = x + 1911 End Func...