On 1/1/07, senthilk_friend <senthilk_friend yahoo.com> 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/
|