Needed script for the version file

view story

http://www.unix.com – I need some help with the logic and syntax for a shell script (ksh) that will search a directory and look for similar files and save only the 5 versions. The version number is in the file name. However, the files are of varying name lengths and may have 1 or many files, with no limit to the number of files. the input file Code: A_14122012.txt A_15122012.txt A_16122012.txt A_17122012.txt the output should contain the present and past one file Code: A_16122012.txt A_17122012.txt i used the below code please sugest the correct script Code: for file in `ls *.txt | sort -r | (HowTos)