I have question about sorting files,and my question is different from other questions about sorting I have a folder including hundereds of files looks like this
anacovaux_1052_summary_betai.out
anacovaux_1052_summary_Pdelta.out
anacovaux_1052_summary_pij.out
anacovaux_1053_DIC.out
anacovaux_1053_summary_betai.out
anacovaux_1053_summary_beta_params.out
anacovaux_1048_DIC.out
anacovaux_1048_summary_betai.out
anacovaux_1043_summary_pi_xtx.out
anacovaux_1058_DIC.out
I wanted to know is there any way that I could sort them numerically? I mean get something like this:
anacovaux_1043_summary_pi_xtx.out
anacovaux_1048_DIC.out
anacovaux_1048_summary_betai.out
anacovaux_1052_summary_betai.out
anacovaux_1052_summary_Pdelta.out
anacovaux_1052_summary_pij.out
anacovaux_1053_DIC.out
anacovaux_1053_summary_betai.out
anacovaux_1053_summary_beta_params.out
anacovaux_1058_DIC.out
ls
should sort them already, as wouldecho *
andprintf '%s\n' *
.ls
or GNUls -v
. For instance, do you wantB_1.out
to sort beforeA_2.out
? You'd wantA2
to sort beforeA10
I presume?