Sponsored Content
Full Discussion: Sort command usage
Top Forums UNIX for Dummies Questions & Answers Sort command usage Post 302858457 by newbie2010 on Monday 30th of September 2013 12:04:10 PM
Old 09-30-2013
Sort command usage

I have one file like this:
Code:
NEW
/ifs/SQL_Backups3/SQL_SharePoint1
NEW
/ifs/SQL_Backups/SQL_SharePoint

This can be easily sorted by the following command:
Code:
cat  file| sort -k3,3n

But I have another file like this:

Code:
/Pool0/local/Benchmark
/Pool0/local/CRAD
/Pool0/local/crdhw/espresso_scratch1
/Pool0/local/crdhw/neo_scratch1
/Pool0/local/crdhw/neo_scratch10
/Pool0/local/crdhw/neo_scratch2
/Pool0/local/crdhw/neo_scratch36
/Pool0/local/crdhw/neo_scratch4
/Pool0/local/crdhw/neo_scratch7

This file can't be sorted by file |sort -k5,5n or any other command.
The only way I've gotten it to sort is by the following:

Code:
file |sort -t/ -k5.12n

I am wondering if there is a certain criteria that will cause you to need to use a character numerical sort instead of a column sort? I am sort of confused on this.

In addition, I am also wondering if sort allows you to use the case insensitive option with numerical sorts. What if I had Scratch4 and scratch4 as paths? From what I can see, you can't use the numerical sort and the -f option even if you specify the column and character to use. It will always put the upper case at the top. Is there a way to turn this off through collation or LC_COLLATE?

Last edited by newbie2010; 09-30-2013 at 03:57 PM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

find command usage

I usually ise find to search a file or name on the unix, since I am not administrator, there will be many line appear 'cannot access',usually a hundred of lines. How can I prevent this line coming out? only show I want? The command I use is : find / -name abcdef -print Thank all expert. (1 Reply)
Discussion started by: zp523444
1 Replies

2. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

3. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

4. Shell Programming and Scripting

How to Sort Floating Numbers Using the Sort Command?

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)
Discussion started by: daniel.gbaena
7 Replies

5. UNIX for Dummies Questions & Answers

Command to display the space usage (memory usage) of a specific directory.

Hi all, Can you please tell me the command, with which one can know the amount of space a specific directory has used. df -k . ---> Displays, the amount of space allocated, and used for a directory. du -k <dir name> - gives me the memory used of all the files inside <dir> But i... (2 Replies)
Discussion started by: abhisheksunkari
2 Replies

6. Shell Programming and Scripting

Is it Possible to sort a list of hexadecimal numbers using "sort" command?

Hello Everybody :) !!!. i have question in mind, is it possible to sort a list of hexadecimal numbers using "sort" command? (9 Replies)
Discussion started by: Kesavan
9 Replies

7. Shell Programming and Scripting

cp -v command usage?

I am trying to output a log file from cp usage. I think this can be achieved. In my code I have this. cp -i -v ~/files/* ~/backups/oldfiles/;; > ~/logs/logfile.logThe error I get is "syntax error near unexpected token '>' What am I missing? (7 Replies)
Discussion started by: gameinn
7 Replies

8. Shell Programming and Scripting

Help to sort out... Possible use of sort command

I have an input like 4.3.6.66 4.3.6.67 4.3.6.70 4.3.6.25 4.3.6.15 4.3.6.54 4.3.6.44 4.3.6.34 4.3.6.24 4.3.6.14 4.3.6.53 4.3.6.43 4.3.6.49 4.3.6.33 4.3.6.52 4.3.6.19 4.3.6.58 4.3.6.42 (5 Replies)
Discussion started by: dnam9917
5 Replies

9. UNIX for Dummies Questions & Answers

Usage of '.' in MV command

Hi, Could you please let me know, why we should not use '.' in move command, if we use it, is it something wrong.. Please share the details on it. /home/rahualux/emp.csv /home/rahualux/details/employee_files/. Or other example for mutlipile files /home/rahualux/*.csv... (3 Replies)
Discussion started by: rahualux
3 Replies
rrpc_inq_interfaces(3ncs)												 rrpc_inq_interfaces(3ncs)

Name
       rrpc_inq_interfaces - obtain a list of the interfaces that a server exports

Syntax
       #include <idl/c/rrpc.h>

       void rrpc_$inq_interfaces(handle, max_ifs, ifs, l_if, status)
       handle_t handle;
       unsigned long max_ifs;
       rrpc_$interface_vec_t ifs[];
       unsigned long *l_if;
       status_$t *status;

Arguments
       handle	      An RPC handle.

       max_ifs	      The maximum number of elements in the array of interface specifiers.

       ifs	      An array of rpc_$if_spec_t.

       l_if	      The index of the last element in the returned array.

       status	      The  completion status.  If the completion status returned in is equal to status_$ok , then the routine that supplied it was
		      successful.

Description
       The routine returns an array of RPC interface specifiers.

Restrictions
       On the client side, because of the way the calls are defined and implemented in the run-time library you  must  explicitly  call  into  the
       entry point vector table for the interface to send an request across the network. The following is an example of a call that works
	 (*rrpc_$client_epv.rrpc_$inq_interfaces)(handle,
		    (unsigned long) max_ifs, ifs, &l_if, &status);
       The server side stub routines call the entry point on behalf of the client.  The results of the call are then passed back to the client.

Files
See Also
       intro(3ncs)

															 rrpc_inq_interfaces(3ncs)
All times are GMT -4. The time now is 10:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy