需要针对.gz文件的grep命令的解决方案

时间:2018-08-14 16:40:02

标签: linux unix grep

我的文件名以RACHEL_20180814_092356.csv.gz开头 并且需要以类似于RACHEL_20180814 * .gz的格式进行grep解压缩,但也无法执行。这是我一直在努力的示例代码。还需要插入一个date参数,该参数每天都会变化。尝试使用zgrep,但我很走运!任何帮助请

处理GMRA文件

echo "Starting file get for Rachel.gz files"
for SUBDIR in prices; do
set -A getlist `/bin/ls ${ENV_DIR_SCR}/bat/prices`

if [ ! -z ${getlist[0]} ]; then
    for FILENAME in ${getlist[*]}; do
        echo "Found File ${ENV_DIR_SCR}/bat/prices/${FILENAME}"

        if [ `echo $FILENAME | grep "RACHEL*.gz"` ]; then
            $FILENAME = gunzip $FILENAME 
            GETFILES="$GETFILES ${FILENAME}"
            break
        fi
    done
fi 
done echo "Completed file_get for RACHEL.gz files"

0 个答案:

没有答案