I have a file with many redundant numbers in each row. Imagine something like the below:
echo "10
9
5
6
4
cell
3
2
0
7
0
1" > test
When I use sort -un test
I get the following output:
cell
1
2
3
4
5
6
7
9
10
while I expect the below (I mean 0
as a first row of the output):
0
1
2
3
4
5
6
7
9
10
Applying the sort -n
and then redirecting to uniq
doesn't make such a mess, however, it shows the non-numeric lines.
Is there any way to just use the sort
with -nu
to get 0
at the first line instead of an alphanumeric token?
Asked by javadr
(131 rep)
Aug 29, 2022, 12:14 PM
Last activity: Aug 29, 2022, 12:21 PM
Last activity: Aug 29, 2022, 12:21 PM