我需要一个句子 if...else.. 来验证限制字符串的文件名是否在 bash 中指定
for j in `ls `
do
if [ "${j:(-3)}" == ".gz" ]; then
Cmd="zcat"
elif [ "${j:(-4)}" == ".bz2" ]; then
Cmd="bzcat"
else
Cmd="cat"
fi
if [ $j ***contains*** "string1"]; then
$cmd $j | awk -F"," '{print $4}'
elif [ $j *contains* "string2" ]; then
$cmd $j | awk -F"," '{print $2}'
fi
done