List Info

Thread: Extract Code




Extract Code
user name
2007-01-03 16:15:39
On 1/3/07, sendilk_krishna <sendilk_krishnayahoo.com> wrote:
> Thanks very much. Please let me know how ot export the
data in to
> CSV file.

What have you tried? What isn't working about that? Do you
know what
CSV format is? You can modify what I sent below very simply
to
transform it into CSV based on what the requirements are for
this data
when you want to use it again. That is left as an exercise
for the
reader.

> -- In perl-beginner@yahoogroups.com, "Dave
Gray" <yargevad...>
> wrote:
> >
> > On 1/1/07, senthilk_friend <senthilk_friend...>
wrote:
> > >   I would like to extract a some word from
log file and export
> the
> > >  those words as a CSV file.
> > >  Can any one help me on this.
> > >
> > >  E.g)
> > >  i need to extract the time stamp (14:57:37),
the word CPU  and
> > >  Current value 8%.
> > >
> > >  Below is the sample log file .
> > >  Kindly help me on this
> > >  krishna
> >
> > perl -ne 'if (/(d+:d+:d+)/) { $ts = $1 } elsif
(/bCPUb/) {
> $flag
> > = 1 } elsif ($flag) { ($pct) = $_ =~ /(d+%)/;
print "[$ts] CPU
> > $pctn"; $flag = 0 }' sample_log_file
> >
> > >  B3692A GlancePlus C.03.86.00    14:57:37
swqapd02 9000/800
> > >  Current  Avg  High
> > > 
----------------------------------------------------------
> > >  ----------
> > >  CPU  Util   SUU                             
                 |
> > >  8%    8%    8%
> > >  Disk Util   FFFF                            
                 |
> > >  8%    8%    8%
> > >
> > > 
----------------------------------------------------------
> > >  ----------
> > >
> > >  PROCESS LIST
> > >                                User      CPU
Util   Cum
> > >  Disk             Thd
> > >  Process Name  PID   PPID  Pri Name    ( 400%
max)  CPU    IO
> Rate
> > >  RSS    Cnt
> > > 
----------------------------------------------------------
> > >  -----------
> > >  oracleUBOM     339      1 154 oraubom   9.5/
0.0     4.9  0.0/
> 0.0
> > >  40.8mb    1
> > >
> > >  B3692A GlancePlus C.03.86.00    14:57:37
swqapd02 9000/800
> > >  Current  Avg  High
> > > 
----------------------------------------------------------
> > >  ----------
> > >  CPU  Util   SUU                             
                 |
> > >  8%    8%    8%
> > >  Disk Util   FFFF                            
                 |
> > >  8%    8%    8%
> > >
> > > 
----------------------------------------------------------
> > >  ----------
> > >
> > >  PROCESS LIST
> > >                                User      CPU
Util   Cum
> > >  Disk             Thd
> > >  Process Name  PID   PPID  Pri Name    ( 400%
max)  CPU    IO
> Rate
> > >  RSS    Cnt
> > > 
----------------------------------------------------------
> > >  -----------
> > >  oracleUBOM     339      1 154 oraubom   9.5/
0.0     4.9  0.0/
> 0.0
> > >  40.8mb    1
> > >
> > >
> >
>
>
>


Unsubscribing info is here: h
ttp://help.yahoo.com/help/us/groups/groups-32.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://g
roups.yahoo.com/group/perl-beginner/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http
://groups.yahoo.com/group/perl-beginner/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:perl-beginner-digest@yahoogroups.com 
    mailto:perl-beginner-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    perl-beginner-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )