I have many files in unix system that match the pattern 'ZLOG_106475_20170517.zip'
where, 106475
denotes the id within the filename.
I want to fetch the names of all such files having id greater than a specific no e.g.
106171
And push the names into a .lst
list file in unix.
Can someone help me?
In bash with a for construct
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