How to see high values on top


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to see high values on top
# 1  
Old 05-11-2010
Java How to see high values on top

Hello folks,

I am searching for pattern, after that i want its presenece on top to bottom basis, like

Code:
cat abcd.txt |grep "123"|awk {'print $3'} |sort|uniq -c

it show result like

Code:
10 1.1.1.1
1 1.1.1.1
15 1.1.1.1
100 1.1.1.1

but i want to see this like

Code:
100 1.1.1.1
15 1.1.1.44
10 1.1.33.1
1 1.1.1.232

high presence on top, low presence on bottom

Last edited by Scott; 05-11-2010 at 05:21 AM.. Reason: Code tags
# 2  
Old 05-11-2010
Code:
cat abcd.txt |grep "123"|awk {'print $3'} |sort|uniq -c |sort -nr


Last edited by Scott; 05-11-2010 at 05:20 AM.. Reason: Code tags
# 3  
Old 05-11-2010
Code:
sort -nr

Btw. it looks like a useless use of cat Smilie

Last edited by pseudocoder; 05-11-2010 at 03:20 AM.. Reason: too slow ;)
# 4  
Old 05-11-2010
Quote:
Originally Posted by pseudocoder
Code:
sort -nr

Btw. it looks like a useless use of cat Smilie
In fact, there are more useless pipes and commands. I just simply add one more command to make the job done.

Here is the one command solution Smilie

Code:
awk '/123/ {a[$3]++}  END {for (i in a) print a[i],i |"sort -nr"}' urfile

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

What is the relation between values from TOP and SAR commands?

Hi, Please have a look at the look at the below top and sar commands. top -bn1 | grep load | awk '{printf "CPU Load: %.2f\n", $(NF-2)}' CPU Load: 0.52 sar -u 1 1 Linux 3.10.0-514.16.1.el7.x86_64 (mymac) 06/01/2017 _x86_64_ (2 CPU) 03:27:40 PM CPU %user %nice ... (1 Reply)
Discussion started by: mohtashims
1 Replies

2. Shell Programming and Scripting

Calculate average of top n% of values - UNIX

Hey guys, I have several huge tab delimited files which look like this: a 1 20 a 3 15 a 5 10 b 2 15 b 6 10 c 3 23 what I am interested is to calculate the average of top n% of data in third column. So for example for this file the top 50% values are: 23 20 (Please note that it... (11 Replies)
Discussion started by: @man
11 Replies

3. BSD

Very high nice percentage in top command

Hello Folks, Recently our FreeBSD 7.1 i386 system became very sluggish. Nothing much is happening over there & whatever is running takes eternity to complete. All the troubleshooting hinted towards a very high nice percentage. Can that be the culprit? Pasting snippets of top command,... (7 Replies)
Discussion started by: vibhor_agarwali
7 Replies

4. Shell Programming and Scripting

Identify high values "ÿ" in a text file using Unix command

I have high values (such as ÿÿÿÿ) in a text file contained in an Unix AIX server. I need to identify all the records which are having these high values and also get the position/column number in the record structure if possible. Is there any Unix command by which this can be done to : 1.... (5 Replies)
Discussion started by: devina
5 Replies

5. AIX

fr and sr (from vmstat output) values are very high

Hi AIX Expert, the fr (page freed/page replacement) and sr (pages scanned by page-replacement algorithm) values from the vmstat output (see below please) are very high. I usually see this high value during the oracle database backup. In addition, the page scan/page steal/ page faults values... (7 Replies)
Discussion started by: Beginer0705
7 Replies

6. Shell Programming and Scripting

How to sum values from top

Hi. Im looking for way to sum numbers from top. For example i have such command top -b -n | grep Cpu | cut -c 35 - 39 which give me output 97.0 . Ho can i do with that value any arithmetic actions (for example 97.0 +1)? Using c = $((top -b -n | grep Cpu | cut -c 35 - 39)) gives me... (8 Replies)
Discussion started by: qdf
8 Replies

7. Shell Programming and Scripting

low & high values

on the file Ftp'd from the mainframe ,do we have any UNIX command to replace mainframe low and values to space or null. i tried using tr and it doesn't work ... Thanks (1 Reply)
Discussion started by: rlmadhav
1 Replies

8. Linux

Help pinpointing high HTTPD CPU usage in TOP

Hi, new here and need some help. Sometimes my site is extremely slow, if when there aren't too many people on, whereas when there are over 300 online members the site may be very fast. We use CentOS, PHP 5.26. The server has 4GB and Plesk usually shows about 2 or 3 GB free. I believe I can see... (4 Replies)
Discussion started by: pspace
4 Replies

9. UNIX for Advanced & Expert Users

Sun: High kernel usage & very high load averages

Hi, I am seeing very high kernel usage and very high load averages on my system (Although we are not loading much data to our database). Here is the output of top...does anyone know what i should be looking at? Thanks, Lorraine last pid: 13144; load averages: 22.32, 19.81, 16.78 ... (4 Replies)
Discussion started by: lorrainenineill
4 Replies

10. UNIX for Dummies Questions & Answers

[Top output] NICE % high ?

Hi, I've got some CPU bottleneck on a HP-UX 11 server : i didn't understand it until i discover i've got an unusual high percentage of NICE% CPU regarding my DBRMS process (Sybase 12.x). How do i have to understand it and how to resolve it ? Thx. (0 Replies)
Discussion started by: eliador2001
0 Replies
Login or Register to Ask a Question