I can't see a suitable "sort" command.
The output file is every line starting with "+1" in the order read followed by every line starting with "-1" in the order read.
One simple way to achive the output is to read the file twice, outputting first the "+1" records then the "-1" records.
Last edited by methyl; 09-17-2010 at 08:40 AM..
Reason: correct input filename.
Hi,
here is my perl script.This script creates an array and is sorting it using the in-built sort function in perl.
#!/usr/local/bin/perl
my number=6;
my @num_arr=(1,2,3,4,5);
my @array=(23,"$number","Hello",2.345,@num_arr);
#printing the array
print... (2 Replies)
Hey guys.
I am trying to sort a file by account number through UNIX. I have a few things but it seems to sort by account number AND sort everything after the account number.
Help please.
Thanks (5 Replies)
Hi,
I am new to PERL.I want to sort all the lines in a file based on 1,2 and 4th filelds.
Can U suggest me a command/function in perl for this operation.. (5 Replies)
I want to sort unique values of column 2 that has the maximum value at column 7. this is my file and desired output
I have a file like this:
AD008 AD0081010180947 101018 0947 0950 1010180947 1010180950
AD008 AD0081010180947 101018 0947 0956 1010180947 1010180956
AD008 AD0081010180947... (12 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
I must write a shell script that calls two external Perl functions--one of which sorts the data in a file, and... (6 Replies)
Hi,
Can anyone tell me why the following program is giving compiler error when I use a friend function of a class as the comparison predicate for the third parameter of std::sort() algorithm? How to correct it, keep the 'friend' intact?
#include <iostream>
#include <vector>
#include <list>... (1 Reply)
Hello there
i have a funny behiavor of the sort fonction, i try it out on different Solaris machine and i have the same issue.
So i would like to see if there is a rationel explanation
here is some data in a file:test.txt
,Test,RSD,RSD_Asset
,Test,RSD,RSD_Credit
,Test,RSD,RSD_Liab... (3 Replies)
Could you please advise on the following: I have two space-delimited files with 9 and 10 columns, respectively, with exactly the same values in column 1. However, the order of column 1 differs between the two files, so I want to sort both files by column 1, so that I can align them and... (6 Replies)
Discussion started by: aberg
6 Replies
LEARN ABOUT SUSE
net::ldap::control::sortresult
Net::LDAP::Control::SortResult(3) User Contributed Perl Documentation Net::LDAP::Control::SortResult(3)NAME
Net::LDAP::Control::SortResult - Server Side Sort (SSS) result control object
SYNOPSIS
use Net::LDAP::Control::Sort;
use Net::LDAP::Constant qw(LDAP_CONTROL_SORTRESULT);
use Net::LDAP::Util qw(ldap_error_name);
$sort = Net::LDAP::Control::Sort->new(
order => "cn -age"
);
$mesg = $ldap->search( @args, control => [ $sort ]);
($resp) = $mesg->control( LDAP_CONTROL_SORTRESULT );
if ($resp) {
if ($resp->result) {
my $attr = $resp->attr;
print "Problem sorting, ",ldap_error_name($resp->result);
print " ($attr)" if $attr;
print "
";
}
else {
print "Results are sorted
";
}
}
else {
print "Server does not support sorting
";
}
DESCRIPTION
"Net::LDAP::Control::SortResult" is a sub-class of Net::LDAP::Control. It provides a class for manipulating the LDAP sort request control
1.2.840.113556.1.4.474 as defined in RFC-2891
A sort result control will be returned by the server in response to a search with a Server Side Sort control. If a sort result control is
not returned then the user may assume that the server does not support sorting and the results are not sorted.
CONSTRUCTOR ARGUMENTS
attr
If "result" indicates that there was a problem with sorting and that problem was due to one of the attributes specified in the sort
control. "attr" is set to the name of the attribute causing the problem.
result
This is the result code that describes if the sort operation was sucessful. If will be one of the result codes describes below.
METHODS
As with Net::LDAP::Control each constructor argument described above is also avaliable 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.
RESULT CODES
Possible results from a sort request are listed below. See Net::LDAP::Constant for a definition of each.
LDAP_SUCCESS
LDAP_OPERATIONS_ERROR
LDAP_TIMELIMIT_EXCEEDED
LDAP_STRONG_AUTH_REQUIRED
LDAP_ADMIN_LIMIT_EXCEEDED
LDAP_NO_SUCH_ATTRIBUTE
LDAP_INAPPROPRIATE_MATCHING
LDAP_INSUFFICIENT_ACCESS
LDAP_BUSY
LDAP_UNWILLING_TO_PERFORM
LDAP_OTHER
SEE ALSO
Net::LDAP, Net::LDAP::Control::Sort, Net::LDAP::Control, http://ww.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.12.1 2010-03-12 Net::LDAP::Control::SortResult(3)