When I sort it numerically using sort -n, it looks like this:
Y
X
M
1
2
3
4
10
11
However, I want it to be like this:
1
2
3
4
10
11
M
X
Y
Well, this was only part of text file. I have a very big text file that I want it to be sorted based on the 3rd column. Above is an example of my third column.
Please help me!
% ./s1
Environment: LC_ALL = C, LANG = C
(Versions displayed with local utility "version")
OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64
Distribution : Debian GNU/Linux 5.0.8 (lenny)
bash GNU bash 3.2.39
msort 8.44
-----
Input data file data1:
b2
a1
b1
A1
y
m
x
1
10
11
2
3
4
M
X
Y
-----
Results of msort, hybrid ordering:
1
2
3
4
10
11
A1
M
X
Y
a1
b1
b2
m
x
y
The msort utility was in the Debian repository for my system. See the URL noted in the script for other options.
% ./user1
Environment: LC_ALL = C, LANG = C
(Versions displayed with local utility "version")
OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64
Distribution : Debian GNU/Linux 5.0.8 (lenny)
bash GNU bash 3.2.39
sort (GNU coreutils) 6.10
awk GNU Awk 3.1.5
-----
Input data file data1:
b2
a1
b1
A1
y
m
x
1
10
11
2
3
4
M
X
Y
-----
Results of sort, re-order with awk:
A1
a1
b1
b2
1
2
3
4
10
11
M
X
Y
m
x
y