Need help
new to shell scripting
there are multiple files in a directory and i need to sort based on timestamp mentioned in the file name
ls -d -- *mdsfcst_1.0_* |sort -t- -nk3
command is wokring fine from putty
but when i enter the same as .sh
its erroring out
Are you looking for a sort in increasing order or decreasing order.
What is the format of your filenames?
If the files are created in the same order as the filenames imply, does the command:
ls -ldt -- *mdsfcst_1.0_*
or the command:
ls -ldtr -- *mdsfcst_1.0_*
come close to what you want?