Difficulty in understanding sort command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Difficulty in understanding sort command
# 1  
Old 01-10-2013
Difficulty in understanding sort command

Hi,

I have used the following command to get result using some program and got desired output but I am unable to understand the last part: sort -k5,5 -rn|head -n 10

Code:
grep Centre groups.dat |sort -k5,5 -rn|head -n 10

Please guide.

Thanks
# 2  
Old 01-10-2013
-k 5,5 means sort on the 5th column. Which column to start on, and which column to end on.
-r means sort in descending order.
-n means sort numerically. (1 2 3 4 5 6 7 8 9 10 11, vs 1 10 11 2 3 4 5 ... )

| head -n 10 means 'only show the first 10 lines'.
These 2 Users Gave Thanks to Corona688 For This Post:
# 3  
Old 01-10-2013
Thanks Corona688. Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk : Need Help in Understanding a command

Hello I am working on a Change request and Stuck at a point. The below awk command is used in the function. float_test ( ) { echo | awk 'END { exit ( !( '"$1"')); }' } I understand that awk 'END' is used to add one line at the end and exit is used to end the script with an error... (4 Replies)
Discussion started by: rahul2662
4 Replies

2. UNIX for Dummies Questions & Answers

Difficulty with set - command

Hi , i have a shell script with the first two lines as #! /bin/ksh set -x when i try opening the file from unix using the command 'sh filename.sh' , i am getting the below error : invalid optionline 2: set: - Pls help Use code tags for you code and data... (1 Reply)
Discussion started by: Rajankum
1 Replies

3. Shell Programming and Scripting

perl command understanding

Hi All, Can you please help me interpret the following command. Which I am not able to understand. Also can you please illustrate what it is used for. perl -pi -e 's/\015//g' text_file.dat Regards (3 Replies)
Discussion started by: rakesh.su30
3 Replies

4. Solaris

Understanding 'du' command

Hi I have a questions related 2 commands : 'du' and 'ls'. Why is the difference between output of 'du' and 'ls' cmd's ? Command 'du' : ------------------ jakubn@server1 /home/jakubn $ du -s * 4 engine.ksh 1331 scripts 'du -s *' ---> shows block count size on disk (512 Bytes... (5 Replies)
Discussion started by: presul
5 Replies

5. 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

6. UNIX for Dummies Questions & Answers

Understanding the output command

Could you please explain me whats happening in the below code, appreciate your help, Thank you. /product/apps/informatica/v7/pc/ExtProc/NewDAC/dacRecBuilder.sh /product/apps/informatica/v7/pc/TgtFiles/NEW_DAC/DAC_Pos_TradeInv_Records.out ... (5 Replies)
Discussion started by: Ariean
5 Replies

7. Shell Programming and Scripting

understanding mv command

hi i was moving a file from one directory to another with the following cmmand mv /home/hsghh/dfd/parent/file.txt . while doing so i i accidently mv /home/hsghh/dfd/dfd . although i gave ctrl c and terminate the move command some of the file are missing in the parent directory and... (1 Reply)
Discussion started by: saravanan71184
1 Replies

8. Shell Programming and Scripting

understanding the kill command

Hi Guys, I like to know if i have a process which triggers 10 different child processes. How to identify out of the 11 processes running which is the parent process and what are the child process? And if i kill the parent process will the child process be killed.. if not is there a way to... (2 Replies)
Discussion started by: mac4rfree
2 Replies

9. Shell Programming and Scripting

understanding the sed command

Guys, I am trying to understand the sed command here. adx001 $ a=/clocal/dctrdata/user/dctrdat1/trdroot/recouncil adx001 $ b=`echo $a | sed 's/\//\\\\\//g'` adx001 $ echo $b \/clocal\/dctrdata\/user\/dctrdat1\/trdroot\/recouncil The sed command i took it from the script. Please... (3 Replies)
Discussion started by: mac4rfree
3 Replies

10. UNIX for Dummies Questions & Answers

Need Help Understanding a Unix Command

Trying to install something. Can someone explain what this means? chmod -R a+r . chmod -R a+w logo.gif tempdir/ templates_c/ I recognize that file permissions are being changed (chmod), but beyond that, it's Greek to me. (6 Replies)
Discussion started by: chris86
6 Replies
Login or Register to Ask a Question