Hello,
suppose i have a student.dat file whose format is
studentno studentname semester marks1 marks2 marks3 total
then how can i sort first in semester wise and then total wise? I mean semester wise ranking wise record should be displayed. Semester should be displayed in ascending order (4 , 5. etc ) and result should be descending order(since it is to be displayed rank wise).
Hi,
I am facing a small problem while I am doing the sort.
Problem Definition:
I have a file which has the following data.
>cat test.dat
zxzxc
asdasd
qwaxcZa
qwaxcA
When I do a sort on this file.
the result set is
asdasd
qwaxcA (4 Replies)
Suppose I want to find the number of uniq lines in a file. I use the following command:
sort file1 | uniq -c | wc -l
But if for some reason sort fails, the above command returns 0 as the answer.
Why would sort fail ? sort makes use of directories /tmp or /var/tmp to store temporary files.... (7 Replies)
I have a text file comprising of 3 columns
1. First column - numeric count/frequency of error codes
2. Second column - alphanumeric hyphenated error code
3. Third column - Error code description (alphanumeric)
184 ABCD-954 Errorcodedescription1
35645 DFMS-323 Errorcodedescription2
43534 ... (2 Replies)
Hi,
I would like to know given that I have 3 columns.
Let say I have first 3 columns to do operation and these operation output is printed out each line by line using AWK and associative array.Currently in the output file, I do a sort by -r for the operation output.
The problem comes to... (1 Reply)
Hi All,
After Sorting directories and files i have got following output as below, now i only want the strings common in them, so the actual output should be as below in the bottom. How do i do that?
Thanks
-adsi
File to be modified:-
Common Components for ----> AA... (4 Replies)
Hello All,
Today i have been asking lots of question, hope to become good in scripting soon with all the wonderful advices i get. The question is i want to sort data a get uniq string from it. The code i am using to generate the output is:-
check_sun() {
for i in $SUN_PLATFORM
do
$ECHO... (0 Replies)
Hi to all.
I'm trying to sort this with the Unix command sort.
user1:12345678:3.5:2.5:8:1:2:3
user2:12345679:4.5:3.5:8:1:3:2
user3:12345687:5.5:2.5:6:1:3:2
user4:12345670:5.5:2.5:5:3:2:1
user5:12345671:2.5:5.5:7:2:3:1
I need to get this:
user3:12345687:5.5:2.5:6:1:3:2... (7 Replies)
I have a file with three fields of data for example say we have
1420 $12.56 45
3456 $15.89 14
2341 $25.87 32
I need to use a command to show who is getting paid the highest amount to standard output. I am not sure if I should use a sort command or a copy and paste... (1 Reply)
Discussion started by: drew211
1 Replies
LEARN ABOUT DEBIAN
linux::kernelsort
Linux::KernelSort(3pm) User Contributed Perl Documentation Linux::KernelSort(3pm)NAME
Linux::KernelSort - Perl extension for sorting and comparing Linux kernel versions. The expected kernel version naming convention is the
same naming convetion demonstrated by http://www.kernel.org. NOTE: Currently, only the 2.6.x series of kernels (including -rc's, -git's,
and -mm's) are properly evaluated.
SYNOPSIS
use Linux::KernelSort;
my $kernel = new Linux::KernelSort;
my $ret;
my $version1 = "2.6.19";
my $version2 = "2.6.19-rc2-git7";
$ret = $kernel->compare($version1, $version2);
if ($ret == 0) {
print "$version1 and $version2 are the same version
";
} elsif ($ret > 0) {
print "$version1 is newer than $version2
";
} else {
print "$version1 is older than $version2
";
}
my @kernel_list = ( '2.6.15',
'2.6.18',
'2.6.18-rc2',
'2.6.18-rc2-git2',
'2.6.18-mm1',
'2.6.18-rc2-mm1' );
my @sorted_list = $kernel->sort(@kernel_list);
print join( ', ', @sorted_list );
DESCRIPTION
Linux::KernelSort is intended to sort a list of kernel versions into ascending order. It also provides the capability to compare two ker-
nel versions and determine if one version is newer, older, or the same as the other version.
FUNCTIONS
version_check() Purpose: Verify the version is valid and follows the proper naming convention demonstrated by http://www.kernel.org Input:
A string containing the kernel version Return: 0 if version is valid 1 if version is invalid
rank()
Purpose: Generate a ranking for a given kernel version
Input: A string containing the kernel version which
follows the proper naming convention demonstrated
by http://www.kernel.org
Return: Kernel ranking
compare()
Purpose: Compare two kernel versions
Input: Strings ($kernel1, $kernel2) each containing a
kernel version which follows the proper naming
conventaion demonstrated by http://www.kernel.org
Return -1 if $kernel1 < $kernel2 (ie $kernel1 is older than $kernel2)
0 if $kernel1 == $kernel2 (ie $kernel1 is the same version as $kernel2)
1 if $kernel1 > $kernel2 (ie $kernel1 is newer than $kernel2)
sort()
Purpose: Sort a list of kernel versions in ascending order.
Uses shell sort algorithm.
Input: Array of strings containing kernel versions which
follows the proper naming convention demonstrated
by http://www.kernel.org
Return: Sorted array
AUTHOR
Leann Ogasawara <lt>ogasawara@osdl.org<gt>
COPYRIGHT AND LICENSE
Linux-KernelSort is Copyright (c) 2006, by Leann Ogasawara. All rights reserved. You may distribute this code under the terms of either
the GNU General Public License or the Artistic License, as specified in the Perl README file.
perl v5.8.8 2008-02-23 Linux::KernelSort(3pm)