分类:
2009-08-21 14:43:52
chinaunix网友2009-09-01 22:02:48
gawk, awk gawk 'BEGIN{FS=OFS="."};{print $1, $2, $3}' <<<"xxx.xxxx.xxxx.tar.bz"
chinaunix网友2009-09-01 21:59:04
another one, bash only #! /bin/bash x="xxx.xxxx.xxxx.tar.bz" x=${x%.*} x=${x%.*} echo $x
chinaunix网友2009-09-01 21:53:47
another method, using shell only #! /bin/bash IFS=. x="xxx.xxxx.xxxx.tar.bz" set -- $x echo "$1.$2.$3"