1.s="abc:    def"
  echo $s
  abc: def
  利用s变量输出orgdef?
  #   echo org${s##* }
  orgdef
  #
2.strs='61.174.144.22107;35' 去掉后5位字符?
  1)echo ${strs%?????}
  2)echo ${strs:0:${#strs}-5}
  3)echo $strs|sed 's/.....$//'
  4)echo $strs|sed -r 's/[;0-9]{5}$//'
  5)echo $strs|cut -b 1-$((${#strs}-5))
  6)echo $strs|awk '{print substr($0,1,length($0)-5)}'
 sed,cut,awk......很全哦
 
3.aaa="[2011-07-07 14:14:15:747]RUN AB81449/AB81449_NTC023:CF FAILURE"
  提取RUN?
  echo $aaa|tr ']' ' '|cut -d ' ' -f3
  echo ${aaa#*]}|cut -d ' ' -f1
4.注意每一行前都有若干空格
        qc-android/device/common
           qc-android/device/htc/common
           qc-android/device/htc/passion
  变成如下效果
  writable = qc-android/platform/manifest
  cat $file|sed 's/^ *//;s/^/writable = /'
5.ksysguardd-4.5.5-1.fc13.x86_64
  gd-devel-2.0.35-11.fc13.x86_64
  gwave-2-18.20090213snap.fc13.x86_64
  fontconfig-2.8.0-1.fc13.i686
  libbeagle-0.3.9-5.fc12.x86_64
  pstoedit-3.45-9.fc12.x86_64
  要求输出类似ksysguardd-*
  cat $file|awk -F '[0-9]' '{print $1"*"}'
  cat $file|sed 's/[0-9].*$/\*/'
  cat $file|awk '{sub(/[0-9].*/,"*")}1'
  ## 估计1代替的print $0,awk可惜只学了点基础的