Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Help Needed with Sorting Output Post 302458644 by wthomas on Friday 1st of October 2010 10:18:30 AM
Old 10-01-2010
Help Needed with Sorting Output

Hi all,

I'm using Solaris 10, and need help in sorting the below output from the syslog file in descending rather than ascending order.
I would like both the hostname and message columns to be sorted, but right now only the message is sorted and the count column, whose order I would like reversed. I need the count column to be sorted listing the highest count at the top.

Command:
Code:
cat messages |awk '{print $4 " " " " $9}' | sort | uniq -c | sort -r|sort +2|more

Output:
Code:
   6 galsw102-b102a.nls.jlrint.com  %LINK-3-UPDOWN:
   6 whjsw213-0905.nls.jlrint.com  %LINK-3-UPDOWN:
   6 whjsw215-1001.nls.jlrint.com  %LINK-3-UPDOWN:
   7 solsw259-b71a.nls.jlrint.com  %LINK-3-UPDOWN:
   7 whjsw192-0901.nls.jlrint.com  %LINK-3-UPDOWN:
 158 solsw137-b02b.nls.jlrint.com  %LINK-3-UPDOWN:
   3 whjsw101-0102.nls.jlrint.com  %LINK-4-ERROR:
   1 cbjsw264-2004.nls.jlrint.com  %PLATFORM_ENV-1-PWR:
   1 whjsw169-0607.nls.jlrint.com  %RTD-1-ADDR_FLAP:
   2 cbjsw190-1101.nls.jlrint.com  %RTD-1-ADDR_FLAP:
   3 cbjsw198-1102.nls.jlrint.com  %RTD-1-ADDR_FLAP:
   3 cbjsw205-1103.nls.jlrint.com  %RTD-1-ADDR_FLAP:
   4 cbjsw204-1103.nls.jlrint.com  %RTD-1-ADDR_FLAP:
  42 hajsw112-0107.nls.jlrint.com  %RTD-1-LINK_FLAP:
  43 solsw137-b02b.nls.jlrint.com  %RTD-1-LINK_FLAP:

Regards, Wynford

Last edited by Scott; 10-03-2010 at 10:35 AM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sorting output

hi, I get an output like uid=user1 gecos=user uid=user2 gecos=admin gecos=sol admin uid=user3 uid=user4 gecos=sol, admin and need it modified to: uid=user1 gecos=user (3 Replies)
Discussion started by: funksen
3 Replies

2. UNIX for Dummies Questions & Answers

sorting cksum output.

Hi guys, I have a service directory with a lot of files in. I have to cksum the whole directory and compare it to a release note document. However the problem I have is the files are listed in different lines when running cksum as they are in the release doc. Therefore cksum shows... (1 Reply)
Discussion started by: Stin
1 Replies

3. Shell Programming and Scripting

Help needed in sorting

Hi, Please I need urgent help in sorting below data, I had similar post but there was a kind of space in between the data but now there is no space and I have tried adjusting the old script to work but it didn't. here are the data; traceroute to 2001:1ba0:2a0:5965:0:30:24:1... (6 Replies)
Discussion started by: sam127
6 Replies

4. UNIX for Dummies Questions & Answers

Help needed sorting syslog columns

Hi all, I need your help in sorting some columns in a syslog report. The command is: for messages in `cat syslog_message_list.txt`; do grep $messages syslog.`date +%d%m%y`.log | \ tr -s " " | cut -d" " -f4,9- | sort| uniq -c >> syslog.`date +%d%m%y`.report; done The output is: 1... (4 Replies)
Discussion started by: wthomas
4 Replies

5. HP-UX

Sorting top command output in HP_UX 11.11

Hello all, I've been woking on Solaris and Linux (Red Hat) so far but now I've inherited an HP-UX system and having minor issues with syntax...Appreciate if you could help me out here.. 1) I'm trying to sort the output of the top command in HP-UX 11.11 by pressing O (capital O) after typing... (2 Replies)
Discussion started by: luft
2 Replies

6. Shell Programming and Scripting

Sorting awk array output?

Hi all, I have a script which produces a nice table but I want to sort it on column 3. This is the output line in the script: # Output { FS = ":"; format = "%11s %6s %-16s\n"; prinft "\n" printf ( format, "Size","Count","Who" ) } for (i in... (21 Replies)
Discussion started by: Cowardly
21 Replies

7. Shell Programming and Scripting

sorting output of echo

can someone please tell me who to sort the numerical output of echo? UIO="8180 0 0 0 0 0 0 0 0 0 0 48240 48240 48240 48240 48240 48240 0 0 0 0 0 0 0 48300 0 0 0 48300" echo $UIO | sort -n This doesn't workk. it does not sort the numbers from smallest to highest. any ideas? (2 Replies)
Discussion started by: SkySmart
2 Replies

8. Shell Programming and Scripting

Sorting output of AWK array

I need help to sort the output of an awk array Example datadata="1 blue 2 green 3 blue 4 yellow 5 blue 6 red 7 yellow 8 red 9 yellow 10 yellow 11 green 12 orange 13 black" My awk line to get output in one lineecho "$data" | awk ' {arr++; next} END { for (i in arr) { if(arr>1 )... (2 Replies)
Discussion started by: Jotne
2 Replies

9. Shell Programming and Scripting

Sorting out unique values from output of for loop.

Hi , i have a belwo script which is used to get sectors per track value extarcted from Solaris machine: for DISK in /dev/dsk/c*t*d*s*; do value=`prtvtoc "$DISK" | sed -n -e '/Dimensions/,/Flags/{/Dimensions/d; /Flags/d; p; }' | sed -n -e '/sectors\/track/p'`; if ; then echo... (4 Replies)
Discussion started by: omkar.jadhav
4 Replies

10. Shell Programming and Scripting

Help needed in sorting

I have a file which contains following lines: 0114714710147 09013 00025.00D986532147 2814714710147 09013 00045.00D985532147 Now, I need to sort the file with above bold and colured one. Means: first sorting will be done by: 147147 then by 10147 09013 after that by 986532147. The... (2 Replies)
Discussion started by: George1234
2 Replies
sawfish(1)						      General Commands Manual							sawfish(1)

NAME
sawfish -- Sawfish window manager. SYNOPSIS
sawfish [--display [=DPY] ] [--multihead ] [--visual [=VISUAL] ] [--depth [=DEPTH] ] [--disable-nls ] [FILE ] [--batch ] [--interp ] [-f, --call FUNCTION ] [-l, --load FILE ] [--version ] [--no-rc ] [-q, --quit ] DESCRIPTION
Sawfish is a lisp-extensible window manager for X11. Its aim is to allow all areas of window management (decoration, manipulation) to be customized as far as is possible, yet still remain as fast or faster than existing window managers. OPTIONS
--display=DPY Connect to X display DPY. --multihead Fork a copy of sawfish for each screen. --visual=VISUAL Preferred VISUAL type. --depth=DEPTH Preferred color DEPTH. --disable-nls Disable internationalization of messages. FILE Load the Lisp file FILE (from the cwd if possible, implies --batch mode). --batch Batch mode: process options and exit. --interp Interpreted mode: don't load compiled Lisp files. -f, --call FUNCTION Call Lisp function FUNCTION. -l, --load FILE Load the file of Lisp forms called FUNCTION. --version Print version details. --no-rc Don't load rc or site-init files. -q, --quit- Terminate the interpreter process. SEE ALSO
Sawfish is documented fully by John Harper available via the Info system. AUTHOR
This manual page was written by Christian Marillat marillat@debian.org for the Debian GNU/Linux system (but may be used by others). sawfish(1)
All times are GMT -4. The time now is 01:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy