wildcards to list a group of files in sequential numerical order ?
________________________________________
From: users-bounces@lists.fedoraproject.org [users-bounces@lists.fedoraproject.org] On Behalf Of linux guy [linuxguy123@gmail.com]
Sent: Monday, November 07, 2011 12:28
To: Community support for Fedora users
Subject: wildcards to list a group of files in sequential numerical order ?
I'd like to list all the files with names between DSC_6035.NEF and
DSC_6072.NEF.
How do I do this ?
I tried using DSC_[6035-6072].NEF, but that doesn't work. It lists
files outside the desired range. The [ ] operator needs just 1
character parameter to work properly ????
________________________________________
Not sure that shell globbing will work here... but you could do something like this in bash:
start=6035
end=6072
list_files()
{
n=$1
while [ $n -le $2 ]; do
f=DSC_${n}.NEF
[ -f ${f} ] && echo $f
n=$(($n + 1))
done
}
ls `list_files $start $end`
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
|