•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 456,444 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,633 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 795 | Replies: 5
![]() |
•
•
Join Date: Aug 2007
Posts: 27
Reputation:
Rep Power: 2
Solved Threads: 0
Hi Guys
I have created a script and everything works but i want my script to sort by the highest count etc.
The script counts the amount of times a job fails , for example the output looks like this:
u08.joebloggs.ndm has failed 1 times
u09joeblogs.rpt has failed 5 times
u10.joeblogs.fw has failed 1 times
How can i get the script to sorted it but the highest amount of times failed.
do i have to use nawk some how, nawk print $ 4 then sort maybe???
Any ideas would be great
I have created a script and everything works but i want my script to sort by the highest count etc.
The script counts the amount of times a job fails , for example the output looks like this:
u08.joebloggs.ndm has failed 1 times
u09joeblogs.rpt has failed 5 times
u10.joeblogs.fw has failed 1 times
How can i get the script to sorted it but the highest amount of times failed.
do i have to use nawk some how, nawk print $ 4 then sort maybe???
Any ideas would be great
scriptname.sh | sort +3nr
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
•
•
Join Date: Aug 2007
Posts: 27
Reputation:
Rep Power: 2
Solved Threads: 0
Hi
The data is emailed to me so its all held here
cat $HOME/scripts/autoinfo1.txt | mailx -s "job failure" joeblogg@hotmail.com
that sort command doesnt work against the script, or if i pipe after i cat the file.
The data is emailed to me so its all held here
cat $HOME/scripts/autoinfo1.txt | mailx -s "job failure" joeblogg@hotmail.com
that sort command doesnt work against the script, or if i pipe after i cat the file.
cat $HOME/scripts/autoinfo1.txt | sort +3nr | mailx -s "job failure" joeblogg@hotmail.com
Last edited by masijade : Nov 29th, 2007 at 9:46 am. Reason: And I hope that's not the real mail address. Spambots here we come.
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
![]() |
•
•
•
•
•
•
•
•
DaniWeb Shell Scripting Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Problem with IF condition (Shell Scripting)
- Open In New Window Php (PHP)
- New to Perl, please explain the script (Perl)
- Comparing two files and output values that match (Shell Scripting)
- modify script (Perl)
- doing a lookup script (Shell Scripting)
- Creating shell script that use snort (Shell Scripting)
- Quick Reference for Linux Commands (Getting Started and Choosing a Distro)
- perl script help re: scope/structure for noob (Perl)
Other Threads in the Shell Scripting Forum
- Previous Thread: parsiring asterisk
- Next Thread: Problem with IF condition



Linear Mode