Sorting

I've been on holiday, and the brain's clearly not back in gear yet...

On Solaris, I have a simple list of package names...

DGBUpPost1.43_R1
DGSApp1.44_S1
DGSApp1.47_V1
DGSApp1.48_W0
DGPEuroC1.10_K0
DGPEuroC1.11_L0
DGPEuroC1.9_J0
DGSRet1.10_K0

I just want to properly sort them into package/version order.

I've tried

cat /tmp/j | sort -t. -k1,2n
DGBUpPost1.43_R1
DGPEuroC1.10_K0
DGPEuroC1.11_L0
DGPEuroC1.9_J0
DGSApp1.44_S1
DGSApp1.47_V1
DGSApp1.48_W0
DGSRet1.10_K0

which doesn't properly sort the version numbers

cat /tmp/j | sort -t. -k2n
DGPEuroC1.9_J0
DGPEuroC1.10_K0
DGSRet1.10_K0
DGPEuroC1.11_L0
DGBUpPost1.43_R1
DGSApp1.44_S1
DGSApp1.47_V1
DGSApp1.48_W0

gets the versions right but mixes the package names.

Any help appreciated.

How about this:

sort -t . -k 1,1 -k 2n,2 /tmp/j

Thanks. Works nicely.

Didn't think about using multiple -k options...that's not in the manual