Loading ...
Sorry, an error occurred while loading the content.
 

Re: Extract Code

Expand Messages
  • Dave Gray
    ... 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
    Message 1 of 8 , Jan 3, 2007
      On 1/3/07, sendilk_kumar <sendilk_kumar@...> 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
      > > > kumar
      > >
      > > perl -ne 'if (/(\d+:\d+:\d+)/) { $ts = $1 } elsif (/\bCPU\b/) {
      > $flag
      > > = 1 } elsif ($flag) { ($pct) = $_ =~ /(\d+%)/; print "[$ts] CPU
      > > $pct\n"; $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
      > > >
      > > >
      > >
      >
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.