Sort command in unix with numeric sort

sort

I have file1:

"$lvl=57"
"$lvl=20"
"$lvl=48"
"$lvl=17"
"$lvl=58"

File2 I want:

"$lvl=17"
"$lvl=20"
"$lvl=48"
"$lvl=57"
"$lvl=58"

Basically numerically sort of file1.

Best Answer

I like -V --version-sort: it behaves very well for many situations mixing strings and numbers

sort -V

I use this option very often...

In the some direction, ls -v for version-sort ls.

Related Question