list all file whose 2nd char is digit!

how to list all files in current directory whose second character is a digit.
i guess i hav to use grep command + ls for this. but dont know how to use?

no need. hint: ?[0-9]*

1 Like

i tried using this:
ls -l | grep ^.[0-9].*$
its not giving any output!!
can some1 tell me where i m wrong?

like i said, no need for grep . have you tried the pattern i suggested ???

wow!! thanks it worked!
:slight_smile:
i didnt even thought it can work directly i was trying to do using gerp only ..
thts gud!
thanks again!

You were trying to match that expression on the output of ls -l.
If you check the output of ls -l, you'll notice that it does not have a digit at the second place, which is why the grep did not have a match.

tyler_durden

oh ye!
thanks man!!