Sponsored Content
Full Discussion: sort problem in solaris unix
Top Forums UNIX for Advanced & Expert Users sort problem in solaris unix Post 302254702 by iamshadow on Wednesday 5th of November 2008 02:16:27 AM
Old 11-05-2008
sort problem in solaris unix

Hi,

The OS I am using is SunOS 5.9 as seen by the command "uname -a". My problem regarding sort is that solaris sort does not have the -s option which I need exactly.

Suppose, the input is like this:

345 t
123 o
567 r
345 a
345 c

I want to sort only on first field and if the field is equal, I want the lines to appear as they are in the input. I tried this:

sort -k 1,1 filename

The output was:

123 o
345 a
345 c
345 t
567 r

But I want the output to be like this:

123 o
345 t
345 a
345 c
567 r

I know that this can be achieved if -s option could be given. But my sort doesn't have it. Any help would be greatly appreciated. Thanks.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Problem with sort

I am attempting to sort a file using the following command: sort +0 -t"|" infilename > outfilename I am getting the following error: sort: 0653-657 A write error occurred while sorting. The file size is 15036274 bytes This is an AIX 5.2 version I believe this is a problem with the... (1 Reply)
Discussion started by: jyoung
1 Replies

2. Shell Programming and Scripting

sort problem

I have file (srv_lst) with the contents as ... 9.2 IRMD115 8.1 IRMD115 and I am using the sort as to get the bigger version as : sort -r -u +1 $srv_lst | sort -k 1,1r and the output is 9.2 which is good .. if I have the contents of file srv_lst as : 9.2 IRMD115 10.2 IRMD115 ... (4 Replies)
Discussion started by: talashil
4 Replies

3. Shell Programming and Scripting

sort order HP UX / SUN Solaris

Hi! simple 'sort' produces a different output on SUN OS than on HP. Lines with empty fields inside the key are sorted at the beginning on SUN; on HP they are at the end. i.e SUN 03|ref|168126310|702578641|||||||||||||| 03|ref|168126310|702578641|DEL| 03|ref|168126310|702578641|FW|... (5 Replies)
Discussion started by: strolchFX
5 Replies

4. IP Networking

network Problem with unix open solaris

Dear Member:- Kindly be I am facing a problem with my open Solaris release b101 1- vi /etc/hostname.reg0 This is my IP address xx.xx.xx.xx 2- vi /etc/netmasks This is my subnet mask 3- vi /etc/defaultrouter This is my gateway 4- vi /etc/resolv.conf This is my DNS written with this way ... (2 Replies)
Discussion started by: dellroxy
2 Replies

5. Solaris

sort -A on Solaris

Hello, Is there any good way of replicating the effects of the Tru64 sort -A command on a Solaris machine? We use sort -A to ignore the locale settings causing files to be sorted differently depending on the user, and since we are moving to Solaris I would like to find an appropriate way of... (1 Reply)
Discussion started by: Indalecio
1 Replies

6. Infrastructure Monitoring

du -sh *| sort -rn in solaris 10

Hi all The command over does not sort corrrectly when used with du -sh (Solaris 10). I have to use du -sk *|sort -rn to sort in the right order. Have anybody has this problem. (5 Replies)
Discussion started by: congngo
5 Replies

7. Programming

sort problem

I am in need of some direction. First off I want to admit this is an assignment but I have hit a block. I need to sort, by the number of times a string occurs (count), and output the top 10. I have found what number gives me the top 10 so from there I need to know how to sort them. Any... (1 Reply)
Discussion started by: Cn00b
1 Replies

8. Shell Programming and Scripting

problem with sort

Hi all, i want to sort by the (1-8) columns and (9-7) columns: my file: MARTINEZ---PAUL --DUPOND---EDDY --DURANDJACQUES --DUPOND--ALAIN output: --DUPOND--ALAIN --DUPOND---EDDY --DURANDJACQUES MARTINEZ---PAUL (6 Replies)
Discussion started by: saw7
6 Replies

9. UNIX for Advanced & Expert Users

Problem with sort +4

Apologies if this should be in 'unix for dummies' thread.. I have a large file containing records like this: 16 Feb 02:49 s_A123_ctas_log.20100216024000.bin 26 Feb 02:55 s_B123_ctas_log.20100226024000.bin 05 Mar 05:22 s_A127_ctas_log.20100305024000.bin I want to sort it by column 4... (2 Replies)
Discussion started by: Grueben
2 Replies

10. UNIX for Dummies Questions & Answers

Sort problem!

Hi, I have a file having content: 123 123 1234 12131 121 23 1212 1212121 23421 1212 1213123 I want to remove the repeated lines from it, i.e. I just want the any number just one time without any sorting in it. The problem is that I am not getting result from 'uniq' command. as... (2 Replies)
Discussion started by: nixhead
2 Replies
CheckDigits::M10_003(3pm)				User Contributed Perl Documentation				 CheckDigits::M10_003(3pm)

NAME
CheckDigits::M10_003 - compute check digits for ISMN SYNOPSIS
use Algorithm::CheckDigits; $ismn = CheckDigits('ismn'); if ($ismn->is_valid('M-345-24680-5')) { # do something } $cn = $ismn->complete('M-345-24680'); # $cn = 'M-345-24680-5' $cd = $ismn->checkdigit('M-345-24680-5'); # $cd = '5' $bn = $ismn->basenumber('M-345-24680-5'); # $bn = 'M-345-24680' DESCRIPTION
ALGORITHM 1. The 'M' as the first number gets the value 3. Beginning left all numbers are weighted alternatively 3 and 1. 2. The sum of all products is computed. 3. The sum of step 3 ist taken modulo 10. 4. The check digit is the difference between 10 and the number from step 3 taken modulo 10. METHODS is_valid($number) Returns true only if $number consists solely of numbers and the last digit is a valid check digit according to the algorithm given above. Returns false otherwise, complete($number) The check digit for $number is computed and concatenated to the end of $number. Returns the complete number with check digit or '' if $number does not consist solely of digits and spaces. basenumber($number) Returns the basenumber of $number if $number has a valid check digit. Return '' otherwise. checkdigit($number) Returns the checkdigit of $number if $number has a valid check digit. Return '' otherwise. EXPORT None by default. AUTHOR
Mathias Weidner, <mathias@weidner.in-bad-schmiedeberg.de> SEE ALSO
perl, CheckDigits, www.pruefziffernberechnung.de. perl v5.10.0 2008-05-17 CheckDigits::M10_003(3pm)
All times are GMT -4. The time now is 12:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy