search in a directory using grep command

Hi,

I want to search files/directories in /temp directory which starts with letter 'a'. How can I do that using grep command.

I can find out like ls -ltr a* but I want to use grep command like ls -ltr | grep ..... like that.

Please help.

Malay

Try

ls -1 | grep "^a"

Why? Why launch a grep process unnecessarily?! Unless you have a huge volume of files to sift through which is going to cause shell expansion problems, why create the additional overhead? :confused:

Cheers
ZB

ls -lt|cut -f2 |grep ^a

Chrs
Rahul

???
This will not output anything useful. In fact, it my directory full of files beginning with the letter "a", it produced no output.

If you really want to use grep, then just do....

ls -1t /some/dir | grep "^a"

Cheers
ZB