Hi All,
I want sort following files in ascending order.
exp_installer_CC4160-file10.dmp
exp_installer_CC4160-file11.dmp
exp_installer_CC4160-file12.dmp
exp_installer_CC4160-file13.dmp
exp_installer_CC4160-file14.dmp
exp_installer_CC4160-file15.dmp
exp_installer_CC4160-file16.dmp
exp_installer_CC4160-file1.dmp
exp_installer_CC4160-file20.dmp
exp_installer_CC4160-file22.dmp
exp_installer_CC4160-file2.dmp
exp_installer_CC4160-file3.dmp
exp_installer_CC4160-file4.dmp
exp_installer_CC4160-file5.dmp
exp_installer_CC4160-file6.dmp
exp_installer_CC4160-file7.dmp
exp_installer_CC4160-file8.dmp
exp_installer_CC4160-file9.dmp
Required Output to be like this:
exp_installer_CC4160-file1.dmp
exp_installer_CC4160-file2.dmp
exp_installer_CC4160-file3.dmp
exp_installer_CC4160-file4.dmp
exp_installer_CC4160-file5.dmp
exp_installer_CC4160-file6.dmp
exp_installer_CC4160-file7.dmp
exp_installer_CC4160-file8.dmp
exp_installer_CC4160-file9.dmp
exp_installer_CC4160-file10.dmp
exp_installer_CC4160-file11.dmp
exp_installer_CC4160-file12.dmp
exp_installer_CC4160-file13.dmp
exp_installer_CC4160-file14.dmp
exp_installer_CC4160-file15.dmp
exp_installer_CC4160-file16.dmp
exp_installer_CC4160-file20.dmp
exp_installer_CC4160-file22.dmp
$ nawk -F"file" '{print $1 "file " $2}' input.txt | sort -k2 -n | sed 's/ //'
exp_installer_CC4160-file1.dmp
exp_installer_CC4160-file2.dmp
exp_installer_CC4160-file3.dmp
exp_installer_CC4160-file4.dmp
exp_installer_CC4160-file5.dmp
exp_installer_CC4160-file6.dmp
exp_installer_CC4160-file7.dmp
exp_installer_CC4160-file8.dmp
exp_installer_CC4160-file9.dmp
exp_installer_CC4160-file10.dmp
exp_installer_CC4160-file11.dmp
exp_installer_CC4160-file12.dmp
exp_installer_CC4160-file13.dmp
exp_installer_CC4160-file14.dmp
exp_installer_CC4160-file15.dmp
exp_installer_CC4160-file16.dmp
exp_installer_CC4160-file20.dmp
exp_installer_CC4160-file22.dmp
This should be sufficient:
sort -t- -nk2.5 input.txt
Hi,
I am working as Jr.Dba in one private company. I am working on some linux scripts (bash shell) which will automate dump import into database. Some clients will send more than ten dump files with their respective comapny name as file extension.
Ex: dell1.dmp, dell2.dmp.....dell33.dmp
Ex: hcl1.dmp, hcl2.dmp.....hcl33.dmp
Ex: cephlon1.dmp, cephlon2.dmp.....cephlon33.dmp
so i need common linux scripts which will sort alphanumeric file names based on last two digits or more usnig bash shell
Regards,
RK
---------- Post updated at 11:00 AM ---------- Previous update was at 10:12 AM ----------
Very nice...Thanq....
It is working fine if a copied dump files in sequence order, but if i copied random order then it showing wrong output.
Ex: file2, file3, file1,file4,file7,file9,file8....