现在的位置: 首页 > 综合 > 正文

type

2014年11月20日 ⁄ 综合 ⁄ 共 1342字 ⁄ 字号 评论关闭

 

#!/bin/bash
#-------------------------
# type.sh
# Version  : 1.0
# Author   :

# Date     : Jan 19 2009
# Secification : The script accomplish searching the same model
#-------------------------

 

#cd "D:\LocalCVS\TDB_SDY_KCG\Factory_Tests\Test_Procedures"
# find out the csv file directory
file=`find . -type f -name "*.csv"`
if [ -z "$file" ] 
then
    echo "Error:the csv file don't exist!"
    exit 1
fi
# search failed!

# dim one searching function:
search () {
    echo "*******************************************"
    echo "You want to search $term"
    echo "*******************************************"
    awk -F";" '{ print $4 }' $file >aa.txt 
    cut -f 3 -d"/" aa.txt >bb.txt

     grep -i "$term" bb.txt >cc.txt
 
  
   for   a   in   $(cat   cc.txt)  
    do  
       grep "$a" $file >temp
     cut -f 1,2 -d";" temp
     echo "---------------------------"
   rm temp
   rm aa.txt
   rm bb.txt
   rm cc.txt
 exit
    done

}

echo "the csv file is : $file"
echo "*****************************************"
echo "**1.arc"
echo "**2.circle"
echo "**3.crown"
echo "**4.line"
echo "**5.rectangle"
echo "**6.shape"
echo "**7.bitmap"
echo "**8.text"
echo "*****************************************"
echo -n "Please select!"
read choice

if [ -z $choice [1-8A-Ba-b] ]
then
echo "Error:your choice is out of the range!"
exit
fi
echo "Your choice is : $choice"
case "$choice" in
  1) term=arc
    ;;
  2) term=circle
    ;;
  3) term=crown
    ;;
  4) term=Line
    ;;
  5) term=rectangle
    ;;
  6) term=shape
    ;;
  7) term=bitmap
    ;;
  8) term=text
    ;;
esac
search $term

 

 

 

抱歉!评论已关闭.