File listing

I can't seem to list all the files that begin with a lower case or upper case letter between a-m while being in that directory?
Please help I've tried everything from all the ls commands to even grep commands.

b

try this:

move into the directory you are playing.

ls | grep [a-mA-m]*

should work fine.....

HI,
Thanks for replying but it's not working - when I run the script nothing happens!

What's wrong?

Pleas help again,

b

Sorry, I made a mistake, try:

ls | grep ^[a-mA-M]

I tried this and it worked.

1 Like

Yeah, your right this does work,

Thanks a lot,

I tried all sorts of ways - but I never included the
pipe "|".

b

Or save a pipe and do:

ls -d [a-mA-M]*

(The '-d' will prevent directories contents from being listed)

1 Like