Hey guys, I have a file that contains the following:
366 K
364 Q
12 UB
7 INC. P
4 Law
2 LAMB
2 High
1 QEG
1 OF
1 LC
1 B
As you can see, it's already sorted by numerical order, how do I sort it again, breaking the ties by using the alphabetical order of the second column, but... (2 Replies)
Looking for help for sort, I learned that for sorting numbers I use:
sort -n
but it seems that that is not enough when you have numbers like 0.2000E+7 for example, sort -n will not worry about the E+7 part, and will just sort the numbers like 0.2000.
Exapmle:
cat example.txt
.91000E+07... (9 Replies)
Hello,
okey so my script is using 4 variables that are either empty or numbers in the following format:
NUMBER_1 NUMBER_2 NUMBER_3 NUMBER_4
So they're basically separated by a space and I need to echo the lowest number, so far I've been doing it like this:
echo "2 3 1 3" | tr " "... (6 Replies)
I would like to know how to sort version numbers, using bash or perl. I would like to sort file names that are program names with version numbers and extensions, such as hello-0.2.3.tar.gz and hello-0.10.3.tar.gz.
Version numbers of computer programs do not comply with the mathematical rule... (3 Replies)
Although i tried multiple option i couldn't find a way to get the rigt ouput.
Say i have the following data
cat file.txt
C request
C response
C request
C response
The output should look like (9 Replies)
I have files like this:
1
3
4
6
14
3
6
I want to extract the highest number. I have tried using
cat filename | sort
but then 9 would become higher than 14.
So how do I sort? (1 Reply)
I have a file which has the following data :-
how can I sort the data in descending order .
My files may have the first column with 1 to 10000 numbers .I need to arrange them in descending order .
Thanks (2 Replies)
Hi,
I've got two arrays
1 3 5 7
2 4 6 8
and i need to write a shell script to get the output 1 2 3 4 5 6 7 8 without using sort or bubble sort. (1 Reply)
I want to sort my data first by the 2nd field then by the first field.
I can't use sort -V because I don't have gnu sort and cannot install one.
How do I go about this?
Input:
G456 KT1 34
K234 KT10 45
L2 KT2 26
H5 LAF2 28
F3 LAF2 36
Output:
G456 KT1 34
L2 KT2 26
K234 KT10 45
F3... (14 Replies)
Discussion started by: aydj
14 Replies
LEARN ABOUT OSX
net::ldap::control::sort
Net::LDAP::Control::Sort(3) User Contributed Perl Documentation Net::LDAP::Control::Sort(3)NAME
Net::LDAP::Control::Sort - Server Side Sort (SSS) control object
SYNOPSIS
use Net::LDAP::Control::Sort;
use Net::LDAP::Constant qw(LDAP_CONTROL_SORTRESULT);
$sort = Net::LDAP::Control::Sort->new(
order => "cn -phone"
);
$mesg = $ldap->search( @args, control => [ $sort ]);
($resp) = $mesg->control( LDAP_CONTROL_SORTRESULT );
print "Results are sorted
" if $resp and !$resp->result;
DESCRIPTION
"Net::LDAP::Control::Sort" is a sub-class of Net::LDAP::Control. It provides a class for manipulating the LDAP Server Side Sort (SSS)
request control 1.2.840.113556.1.4.473 as defined in RFC-2891
If the server supports sorting, then the response from a search operation will include a sort result control. This control is handled by
Net::LDAP::Control::SortResult.
CONSTRUCTOR ARGUMENTS
order
A string which defines how entries may be sorted. It consists of multiple directives, spearated by whitespace. Each directive describes
how to sort entries using a single attribute. If two entries have identical attributes, then the next directive in the list is used.
Each directive specifies a sorting order as follows
-attributeType:orderingRule
The leading "-" is optional, and if present indicates that the sorting order should be reversed. "attributeType" is the attribute name
to sort by. "orderingRule" is optional and indicates the rule to use for the sort and should be valid for the given "attributeType".
Any one attributeType should only appear once in the sorting list.
Examples
"cn" sort by cn using the default ordering rule for the cn attribute
"-cn" sort by cn using the reverse of the default ordering rule
"age cn" sort by age first, then by cn using the default ordering rules
"cn:1.2.3.4" sort by cn using the ordering rule defined as 1.2.3.4
METHODS
As with Net::LDAP::Control each constructor argument described above is also available as a method on the object which will return the
current value for the attribute if called without an argument, and set a new value for the attribute if called with an argument.
SEE ALSO
Net::LDAP, Net::LDAP::Control::SortResult, Net::LDAP::Control, http://www.ietf.org/rfc/rfc2891.txt
AUTHOR
Graham Barr <gbarr@pobox.com>
Please report any bugs, or post any suggestions, to the perl-ldap mailing list <perl-ldap@perl.org>
COPYRIGHT
Copyright (c) 1999-2004 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the
same terms as Perl itself.
perl v5.16.2 2012-09-20 Net::LDAP::Control::Sort(3)