highestVersion() {
for TEST_PATH in `ls -a "$/TEMP"/*.flg`
do
echo " you are here"
TEST_FILE=`basename "$TEST_PATH"`
echo "$TEST_FILE"
done
}
Below is the file TEST_FILE. In this case for example "RMG" is a book name having 4 version. How can I pick the file with latest version among these set of files and store it in a variable? How can I iterate through this, so that at the end, the variable should contain only the unique filename with highest version number?
ABC_EFG_FLOOL_DR3GCTEU_19951223_HANSHAKE_V03.flg
ABC_EFG_FLOOL_DR3GCTPC_19951223_HANSHAKE_V03.flg
ABC_RFTY_PICK_AMTY_19951223_HANSHAKE_V03.flg
ABC_JANE_PICK_AMTY_19951223_HANSHAKE_V02.flg
ABC_XYZ_RMG_19951223_HANSHAKE_V01.flg
ABC_XYZ_RMG_19951223_HANSHAKE_V02.flg
ABC_XYZ_RMG_19951223_HANSHAKE_V03.flg
ABC_XYZ_RMG_19951223_HANSHAKE_V11.flg
ABC_XYZ_ALG0_19951223_HANSHAKE_V02.flg
ABC_XYZ_SGFXMM_19951223_HANSHAKE_V03.flg
ABC_XYZ_STRIP_FULLREVAL_YU_1234_19951223_HANSHAKE_V02.flg
ABC_XYZ_STRIP_FULLREVAL_YU_1234_19951223_HANSHAKE_V03.flg