File existence using ls

Hi

I want to check a particular file is available or not. But i know only the pattern of that file sat AB1234*.txt.I need the latest file name and it ll be used in the script. How can i do this using ls -ltr command.

Thanks,
LathishSundar V

Use the tail command, check the man page.

Regards

ls -ltr AB1234*.txt | tail -1 | read latest_filename