Grep 5 biggest column


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Grep 5 biggest column
# 1  
Old 04-03-2013
Grep 5 biggest column

please help,

file1.txt

Code:
id,week,ict,outgoing_call,blackberry_problem,gprs_problem,sms_problem,flash_problem,sinyal_lemah,blankspot,incoming_call,mms_problem,kualitas_suara,drop_call,data_probl
em,cross_connect,connect_no_voice,vas_problem
,1,sumbagsel,96,127,52,70,28,29,21,18,18,8,5,3,0,0,3
,2,sumbagsel,109,156,80,74,47,47,32,15,24,8,15,4,0,0,4
,3,sumbagsel,123,174,56,65,45,62,28,13,17,7,607,3,1,1,3
,4,sumbagsel,199,190,65,90,40,81,37,21,19,9,15,5,0,1,5
,5,sumbagsel,109,153,58,75,40,42,25,33,22,8,17,4,1,0,4
,6,sumbagsel,97,137,68,56,47,34,27,23,13,8,10,2,1,1,2
,7,sumbagsel,90,105,49,97,54,39,22,17,18,9,7,3,0,1,3
,8,sumbagsel,60,79,43,57,39,35,14,12,11,4,2,2,1,0,2
,9,sumbagsel,58,110,30,44,32,34,13,8,10,3,2,1,1,0,1
,10,sumbagsel,69,61,60,51,8,43,11,12,24,7,5,0,3,2,0
,11,sumbagsel,86,71,50,45,30,22,8,4,11,9,8,3,2,0,3
,12,sumbagsel,75,67,28,50,25,45,10,9,14,5,5,1,1,0,1
,13,sumbagsel,41,50,18,28,24,21,6,7,11,1,5,4,1,0,4

---------- Post updated at 04:34 AM ---------- Previous update was at 04:28 AM ----------

---------- Post updated at 04:39 AM ---------- Previous update was at 04:34 AM ----------

need to sort column based on the latest week (in this week is week=13)

expected output
file2.txt

Code:
       
id,week,ict,blackberry_problem,outgoing_call,sms_problem,flash_problem,sinyal_lemah  
,1,sumbagsel,127,96,70,28,29      
,2,sumbagsel,156,109,74,47,47      
,3,sumbagsel,174,123,65,45,62      
,4,sumbagsel,190,199,90,40,81      
,5,sumbagsel,153,109,75,40,42      
 ,6,sumbagsel,137,97,56,47,34      
,7,sumbagsel,105,90,97,54,39      
,8,sumbagsel,79,60,57,39,35      
,9,sumbagsel,110,58,44,32,34      
,10,sumbagsel,61,69,51,8,43      
,11,sumbagsel,71,86,45,30,22      
,12,sumbagsel,67,75,50,25,45      
,13,sumbagsel,50,41,28,24,21

# 2  
Old 04-03-2013
If the last week's data had been:
Code:
id,week,ict,outgoing_call,blackberry_problem,gprs_problem,sms_problem,flash_problem,sinyal_lemah,blankspot,incoming_call,mms_problem,kualitas_suara,drop_call,data_problem,cross_connect,connect_no_voice,vas_problem
,13,sumbagsel,41,50,21,28,24,21,6,7,11,21,5,4,21,0,4

instead of:
Code:
id,week,ict,outgoing_call,blackberry_problem,gprs_problem,sms_problem,flash_problem,sinyal_lemah,blankspot,incoming_call,mms_problem,kualitas_suara,drop_call,data_problem,cross_connect,connect_no_voice,vas_problem
,13,sumbagsel,41,50,18,28,24,21,6,7,11,1,5,4,1,0,4

how would you select which column(s) with value 21 should be printed?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep values from column 2 in reference of column 1

Gents Is it possible to update the code to get the desired output files from the input list. I called variable to the first column. I need to consider the first column as key to grep the values in the second column according to the desired request. input list (attached ) output1 ... (12 Replies)
Discussion started by: jiam912
12 Replies

2. UNIX for Beginners Questions & Answers

Grep A Column Based On Column Name

I have a file with two columns separated by white space. Dog Cat fido sneaky dopey poptart ears whisker barky herd Trying to list the words under the column named Dog. Tried a few variations of awk but can't... (4 Replies)
Discussion started by: jimmyf
4 Replies

3. Shell Programming and Scripting

How to awk or grep the last column in file when date on column contains spaces?

Hi have a large spreadsheet which has 4 columns APM00111803814 server_2 96085 Corp IT Desktop and Apps APM00111803814 server_2 96085 Corp IT Desktop and Apps APM00111803814 server_2 96034 Storage Mgmt Team APM00111803814 server_2 96152 GWP... (6 Replies)
Discussion started by: kieranfoley
6 Replies

4. Shell Programming and Scripting

How to find biggest word in a file....?

With any cmd like sed grep ask etc... (1 Reply)
Discussion started by: sidpatil
1 Replies

5. Shell Programming and Scripting

help to get the biggest partition with awk

# fdisk -l /dev/sda Disk /dev/sda: 1000.2 GB, 1000204886016 bytes 255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk... (9 Replies)
Discussion started by: yanglei_fage
9 Replies

6. HP-UX

Biggest files on FS /

Hi! I'm using Unix HP I'm looking for a command which find the 20 (less or more) biggest files on / but which exclude every other files system Thanks;) (7 Replies)
Discussion started by: Castelior
7 Replies

7. Shell Programming and Scripting

Top 5 biggest file

Hi , I need to get a list of name and size , of the the top 5 biggest file under the current directory , in decending order Thank You (4 Replies)
Discussion started by: yoavbe
4 Replies

8. Shell Programming and Scripting

finding biggest number

I think my script is working but i am trying to understand while I am tracing to see if it's realli working.. can somebody please comment.. also. is there different way to write this in shell? sh -x findbiggestnum 1 2 3 + big=0 + big=1 + big=2 + big=3 + echo 3 3 big=0 ... (3 Replies)
Discussion started by: hankooknara
3 Replies

9. Solaris

top biggest files

hi all, is there any way how i can output the top 10-30 biggest files for all filesystem? using du -sh * is quite tedious since i have to move from 1 directory at a time. thanks (3 Replies)
Discussion started by: 3rr0r_3rr0r
3 Replies

10. UNIX for Dummies Questions & Answers

The biggest newb ever...

Hi, all you unix people. I am a pretty advanced windows user, but I am curious about unix. Is there any reason I should attempt to acquire some form of unix for my home computer system? What sort of things is unix useful for? Unix is open source, right? Assuming that to be the case, I infer that... (3 Replies)
Discussion started by: BoneMalone
3 Replies
Login or Register to Ask a Question