Sponsored Content
Top Forums Shell Programming and Scripting Counting lines for each application Post 302451442 by rdcwayx on Tuesday 7th of September 2010 12:35:52 AM
Old 09-07-2010
Looks fine.
Code:
awk 'NF>0 {a[$9]++}END{for (i in a) print i " : " a[i]|"sort -k3nr"}' infile

oracleAAA : 15
oracleBBB : 7
ora_ckpt_AAA : 1
ora_ckpt_BBB : 1
ora_mmon_AAA : 1
ora_psp0_AAA : 1
ora_psp0_BBB : 1
ora_qmnc_AAA : 1
ora_qmnc_BBB : 1

or do you mean you need count ora_psp0_AAA, ora_ckpt_AAA , and oracleAAA as AAA?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Counting lines and files

Hi experts, First of all thanks for all your help. How can i count the lines within a text file and send this number to another text file? And by the way how can i count the number of files inside a tape ("/dev/rtp") that as one pattern (Ex. "/CTA/") and send this number to a text file? I... (6 Replies)
Discussion started by: jorge.ferreira
6 Replies

2. Linux

counting the number of lines

Hello, I have afile which begins with a few urls on multiple lines and then there is listing of some information on separate lines. The listing begins with the word Name on a given line followed by teh actual list. I want to count the number of lines in this file after the line having... (6 Replies)
Discussion started by: nayeemmz
6 Replies

3. UNIX for Dummies Questions & Answers

displaying/ counting lines

I have a file called xx with the env redirected into it 5 times: env >> xx env >> xx env >> xx env >> xx env >> xx I have to read an input file (here: xx) and look for occurrences of the current user who is executing this script. Once finding an occurrence of the username I have to take that... (4 Replies)
Discussion started by: aga
4 Replies

4. Shell Programming and Scripting

displaying/ counting lines

I have a file called xx with the env redirected into it 5 times: env >> xx env >> xx env >> xx env >> xx env >> xx I have to read an input file (here: xx) and look for occurrences of the current user who is executing this script. Once finding an occurrence of the username I have to take that... (2 Replies)
Discussion started by: aga
2 Replies

5. Shell Programming and Scripting

Counting lines between two patterns

Hi Guys, I have a file as follows: wwe khfgv jfo wwe jhgfd wwe wwe hoaha hao lkahe wwe (13 Replies)
Discussion started by: npatwardhan
13 Replies

6. Shell Programming and Scripting

Counting similar lines

Hi, I have a little problem with counting lines. I know similar topics from this forum, but they don't resolve my problem. I have file with lines like this: 2009-05-25 16:55:32,143 some text some regular expressions ect. 2009-05-25 16:55:32,144 some text. 2009-05-28 18:15:12,148 some... (4 Replies)
Discussion started by: marcinnnn
4 Replies

7. UNIX for Advanced & Expert Users

Delete # of Lines after counting

I'm trying to write a script to clean up log file automatically when it reaches 1000 lines. I can't get this to work..can some help me please :) Server: SunOS 5.8 Generic_117350-53 sun4u sparc SUNW,Netra-T12 #!/bin/ksh #file reference file=`echo "$HOME/support/moe/b.tc"` #linecount... (7 Replies)
Discussion started by: moe458
7 Replies

8. Shell Programming and Scripting

sed counting lines

Hi, I'm using the command: sed -n '$=' $1 on a sh script on AIX. This script is used to count the number of lines of files. If the file has no lines at all the command doesn't return nothing. I need the command to return 0 when the file has no lines at all. How can I achieve this? Best... (5 Replies)
Discussion started by: jppedroso
5 Replies

9. UNIX for Dummies Questions & Answers

Counting # of lines

Counting number of lines: sp I am trying to figure out a script to count the number of text files in cywig and have it give me a number (as the answer) any help would be appreciated. I am new here, so be gentle :D (3 Replies)
Discussion started by: unicksjp
3 Replies

10. Shell Programming and Scripting

Tailing and counting lines

tail -f /var/log/syslog | egrep -c FATAL is there a way to do the above and actually have the number of lines matching the pattern increment as it is logged to the log file? for instance, when you invoke a command like the one i just posted, you'll not get the total lines unless you do... (4 Replies)
Discussion started by: SkySmart
4 Replies
App::Info::Handler::Carp(3pm)				User Contributed Perl Documentation			     App::Info::Handler::Carp(3pm)

NAME
App::Info::Handler::Carp - Use Carp to handle App::Info events SYNOPSIS
use App::Info::Category::FooApp; use App::Info::Handler::Carp; my $carp = App::Info::Handler::Carp->new('carp'); my $app = App::Info::Category::FooApp->new( on_info => $carp ); # Or... my $app = App::Info::Category::FooApp->new( on_error => 'croak' ); DESCRIPTION
App::Info::Handler::Carp objects handle App::Info events by passing their messages to Carp functions. This means that if you want errors to croak or info messages to carp, you can easily do that. You'll find, however, that App::Info::Handler::Carp is most effective for info and error events; unknown and prompt events are better handled by event handlers that know how to prompt users for data. See App::Info::Handler::Prompt for an example of that functionality. Upon loading, App::Info::Handler::Carp registers itself with App::Info::Handler, setting up a number of strings that can be passed to an App::Info concrete subclass constructor. These strings are shortcuts that tell App::Info how to create the proper App::Info::Handler::Carp object for handling events. The registered strings are: carp Passes the event message to "Carp::carp()". warn An alias for "carp". croak Passes the event message to "Carp::croak()". die An alias for "croak". cluck Passes the event message to "Carp::cluck()". confess Passes the event message to "Carp::confess()". INTERFACE
Constructor new my $carp_handler = App::Info::Handler::Carp->new; $carp_handler = App::Info::Handler::Carp->new( level => 'carp' ); my $croak_handler = App::Info::Handler::Carp->new( level => 'croak' ); Constructs a new App::Info::Handler::Carp object and returns it. It can take a single parameterized argument, "level", which can be any one of the following values: carp Constructs a App::Info::Handler::Carp object that passes the event message to "Carp::carp()". warn An alias for "carp". croak Constructs a App::Info::Handler::Carp object that passes the event message to "Carp::croak()". die An alias for "croak". cluck Constructs a App::Info::Handler::Carp object that passes the event message to "Carp::cluck()". confess Constructs a App::Info::Handler::Carp object that passes the event message to "Carp::confess()". If the "level" parameter is not passed, "new()" will default to creating an App::Info::Handler::Carp object that passes App::Info event messages to "Carp::carp()". BUGS
Please send bug reports to <bug-app-info@rt.cpan.org> or file them at <http://rt.cpan.org/NoAuth/Bugs.html?Dist=App-Info>. AUTHOR
David Wheeler <david@justatheory.com> SEE ALSO
App::Info documents the event handling interface. Carp of documents the functions used by this class. App::Info::Handler::Print handles events by printing their messages to a file handle. App::Info::Handler::Prompt offers event handling more appropriate for unknown and confirm events. App::Info::Handler describes how to implement custom App::Info event handlers. COPYRIGHT AND LICENSE
Copyright (c) 2002-2008, David Wheeler. Some Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2011-03-15 App::Info::Handler::Carp(3pm)
All times are GMT -4. The time now is 02:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy