I have one scenario which I should need to implement in the Unix. In a directory, I would like to delete the files based on the appended date at the end of the file, these files are XML back files. The files should be deleted based on the below criteria. Keep only 3 lasted date files(Appended date in the files) in the set of files and delete remaining files.
Wf_ABC_201801011224.xml wf_ABC_201801011220.xml Wf_ABC_201801011241.xml wf_ABC_201801011230.xml Wf_ABC_201801011244.xml wf_ABC_201801011260.xml
Wf_DCB_201501021224.xml wf_DCB_201601031220.xml Wf_DCB_201601041241.xml wf_DCB_201401051230.xml Wf_DCB_201701061244.xml wf_DCB_201801061260.xml
Wf_XYZ_201501011224.xml wf_XYZ_201601011220.xml Wf_XYZ_201701011241.xml wf_XYZ_201801011230.xml Wf_XYZ_201801021244.xml wf_XYZ_201801031260.xml Wf_XYZ_201501041224.xml wf_XYZ_201601051220.xml Wf_XYZ_201601061241.xml wf_XYZ_201401071230.xml Wf_XYZ_201701081244.xml wf_XYZ_201801091260.xml