在 UNIX 中查找并列出 file_names 包含数字和日期,如果大于特定数字
In UNIX find and list file_names consisting number and date, if greater than a specific number
我在 unix 系统中有很多文件匹配模式 'ZLOG_106475_20170517.zip'
其中,106475
表示文件名中的 id。
I want to fetch the names of all such files having id greater than a
specific no e.g. 106171
并将名称推送到 unix 中的 .lst
列表文件中。
有人可以帮助我吗?
在 bash 中使用 for 构造
for file in ZLOG_*.zip; do
[[ -e $file ]] || continue # check file exist
id=${file#ZLOG_} # remove prefix
id=${id%%_*} # remove suffix
if ((id>106171)); then
echo "$file"
fi
done >list.txt
我在 unix 系统中有很多文件匹配模式 'ZLOG_106475_20170517.zip'
其中,106475
表示文件名中的 id。
I want to fetch the names of all such files having id greater than a specific no e.g.
106171
并将名称推送到 unix 中的 .lst
列表文件中。
有人可以帮助我吗?
在 bash 中使用 for 构造
for file in ZLOG_*.zip; do
[[ -e $file ]] || continue # check file exist
id=${file#ZLOG_} # remove prefix
id=${id%%_*} # remove suffix
if ((id>106171)); then
echo "$file"
fi
done >list.txt