How to get the same sorting result for this pattern
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
When I use sort -n -k 2 -r
on a text like this one:
último 12
últimos 5
única 27
único 227
úteis 2
útil 1
I get the expected result as you can see:
único 227
única 27
último 12
últimos 5
úteis 2
útil 1
Do you guys know if it is possible to get this working for the second column of a pattern like this ??
(zelar,12)
(zero,1)
(zes,1)
(zeze,12)
(ziza,2)
(zo,1)
(zona,6)
sort
add a comment |Â
up vote
2
down vote
favorite
When I use sort -n -k 2 -r
on a text like this one:
último 12
últimos 5
única 27
único 227
úteis 2
útil 1
I get the expected result as you can see:
único 227
única 27
último 12
últimos 5
úteis 2
útil 1
Do you guys know if it is possible to get this working for the second column of a pattern like this ??
(zelar,12)
(zero,1)
(zes,1)
(zeze,12)
(ziza,2)
(zo,1)
(zona,6)
sort
2
Is it sufficient to set the field separator to,
i.e.sort -t, -n -k 2 -r
?
â steeldriver
Nov 5 '17 at 0:39
@steeldriver thank you, it worked like a charm :-)
â Gabriel
Nov 5 '17 at 0:53
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
When I use sort -n -k 2 -r
on a text like this one:
último 12
últimos 5
única 27
único 227
úteis 2
útil 1
I get the expected result as you can see:
único 227
única 27
último 12
últimos 5
úteis 2
útil 1
Do you guys know if it is possible to get this working for the second column of a pattern like this ??
(zelar,12)
(zero,1)
(zes,1)
(zeze,12)
(ziza,2)
(zo,1)
(zona,6)
sort
When I use sort -n -k 2 -r
on a text like this one:
último 12
últimos 5
única 27
único 227
úteis 2
útil 1
I get the expected result as you can see:
único 227
única 27
último 12
últimos 5
úteis 2
útil 1
Do you guys know if it is possible to get this working for the second column of a pattern like this ??
(zelar,12)
(zero,1)
(zes,1)
(zeze,12)
(ziza,2)
(zo,1)
(zona,6)
sort
asked Nov 5 '17 at 0:23
Gabriel
133
133
2
Is it sufficient to set the field separator to,
i.e.sort -t, -n -k 2 -r
?
â steeldriver
Nov 5 '17 at 0:39
@steeldriver thank you, it worked like a charm :-)
â Gabriel
Nov 5 '17 at 0:53
add a comment |Â
2
Is it sufficient to set the field separator to,
i.e.sort -t, -n -k 2 -r
?
â steeldriver
Nov 5 '17 at 0:39
@steeldriver thank you, it worked like a charm :-)
â Gabriel
Nov 5 '17 at 0:53
2
2
Is it sufficient to set the field separator to
,
i.e. sort -t, -n -k 2 -r
?â steeldriver
Nov 5 '17 at 0:39
Is it sufficient to set the field separator to
,
i.e. sort -t, -n -k 2 -r
?â steeldriver
Nov 5 '17 at 0:39
@steeldriver thank you, it worked like a charm :-)
â Gabriel
Nov 5 '17 at 0:53
@steeldriver thank you, it worked like a charm :-)
â Gabriel
Nov 5 '17 at 0:53
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
3
down vote
accepted
Add -t,
to your sort
command to make it use comma as the field separator.ÃÂ
(You can add it to the command anywhere except between the -k
and the 2
.)ÃÂ
Note that this will not grant any special significance to the parentheses,
so, if you have some rows with parentheses and some without,
then lines where the number in the second column are equal will sort like this:
z,â¦
a,â¦
9,â¦
ï¸Â
2,â¦
10,â¦
1,â¦
(zâ¦),â¦
(aâ¦),â¦
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
Add -t,
to your sort
command to make it use comma as the field separator.ÃÂ
(You can add it to the command anywhere except between the -k
and the 2
.)ÃÂ
Note that this will not grant any special significance to the parentheses,
so, if you have some rows with parentheses and some without,
then lines where the number in the second column are equal will sort like this:
z,â¦
a,â¦
9,â¦
ï¸Â
2,â¦
10,â¦
1,â¦
(zâ¦),â¦
(aâ¦),â¦
add a comment |Â
up vote
3
down vote
accepted
Add -t,
to your sort
command to make it use comma as the field separator.ÃÂ
(You can add it to the command anywhere except between the -k
and the 2
.)ÃÂ
Note that this will not grant any special significance to the parentheses,
so, if you have some rows with parentheses and some without,
then lines where the number in the second column are equal will sort like this:
z,â¦
a,â¦
9,â¦
ï¸Â
2,â¦
10,â¦
1,â¦
(zâ¦),â¦
(aâ¦),â¦
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
Add -t,
to your sort
command to make it use comma as the field separator.ÃÂ
(You can add it to the command anywhere except between the -k
and the 2
.)ÃÂ
Note that this will not grant any special significance to the parentheses,
so, if you have some rows with parentheses and some without,
then lines where the number in the second column are equal will sort like this:
z,â¦
a,â¦
9,â¦
ï¸Â
2,â¦
10,â¦
1,â¦
(zâ¦),â¦
(aâ¦),â¦
Add -t,
to your sort
command to make it use comma as the field separator.ÃÂ
(You can add it to the command anywhere except between the -k
and the 2
.)ÃÂ
Note that this will not grant any special significance to the parentheses,
so, if you have some rows with parentheses and some without,
then lines where the number in the second column are equal will sort like this:
z,â¦
a,â¦
9,â¦
ï¸Â
2,â¦
10,â¦
1,â¦
(zâ¦),â¦
(aâ¦),â¦
answered Nov 5 '17 at 0:55
G-Man
11.6k82657
11.6k82657
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f402571%2fhow-to-get-the-same-sorting-result-for-this-pattern%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
2
Is it sufficient to set the field separator to
,
i.e.sort -t, -n -k 2 -r
?â steeldriver
Nov 5 '17 at 0:39
@steeldriver thank you, it worked like a charm :-)
â Gabriel
Nov 5 '17 at 0:53