Deleting particular files with a numerical suffix

Hello

I have a directory with a list of files which have a particular numerical suffix.

E.g

filename_0
filename_1
filename_18500
filename_10000

I want to delete all files from this directory which have a filename which have a numerical suffix greater than 10540.

So any files with a filename greater than filename_10540.

Thanks

Kamal

Hi

$ ls filename_* | awk -F_ '$2>10540{print "rm "$0;}' | sh

Guru.

$ ls | rm `awk -F"_" ' $2 > 10540 '`

Does this work???

for i in *;do num=${i#filename_}; if [ $num -gt 10000 ];then rm $i; fi; done

@summer_cherry: for i in filename_*; do , no?