PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > Extract runtime from logfile
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

Extract runtime from logfile

Réponse
 
LinkBack Outils de la discussion
Vieux 05/12/2006, 01h18   #1
romy
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Extract runtime from logfile

Hello friends,

I want to extract the runtime information from log file. The log file
looks like this :

LOG FILE :

--------------------------------------------------------------------------------
Dec 04 19:57:21 Phase 0 ended (126 seconds)
CPU Time Status Skew Vertex
1.810 [ : 1] 0%
--------------------------------------------------------------------------------
1.810 [ : 1] 0%
--------------------------------------------------------------------------------
Data Bytes Records Status Skew Flow Vertex
Port
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Dec 04 19:59:30 Phase 1 started (0 seconds)
CPU Time Status Skew Vertex
0.000 [ 1: ] 0%
0.010 [ 1: ] 0%
--------------------------------------------------------------------------------
Data Bytes Records Status Skew Flow Vertex
Port
--------------------------------------------------------------------------------


And the runtime information is embedded in log file , for eg, Dec 04
19:57:21 and Dec 04 19:59:30 in above log file. How can exatrct this
information using shell script ?

  Réponse avec citation
Vieux 05/12/2006, 01h24   #2
Ed Morton
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Extract runtime from logfile

romy wrote:

> Hello friends,
>
> I want to extract the runtime information from log file. The log file
> looks like this :
>
> LOG FILE :
>
> --------------------------------------------------------------------------------
> Dec 04 19:57:21 Phase 0 ended (126 seconds)
> CPU Time Status Skew Vertex
> 1.810 [ : 1] 0%
> --------------------------------------------------------------------------------
> 1.810 [ : 1] 0%
> --------------------------------------------------------------------------------
> Data Bytes Records Status Skew Flow Vertex
> Port
> --------------------------------------------------------------------------------
> --------------------------------------------------------------------------------
> Dec 04 19:59:30 Phase 1 started (0 seconds)
> CPU Time Status Skew Vertex
> 0.000 [ 1: ] 0%
> 0.010 [ 1: ] 0%
> --------------------------------------------------------------------------------
> Data Bytes Records Status Skew Flow Vertex
> Port
> --------------------------------------------------------------------------------
>
>
> And the runtime information is embedded in log file , for eg, Dec 04
> 19:57:21 and Dec 04 19:59:30 in above log file. How can exatrct this
> information using shell script ?
>


Which of the various time fields above is the "runtime"?

Ed.
  Réponse avec citation
Vieux 05/12/2006, 03h55   #3
romy
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Extract runtime from logfile


> > And the runtime information is embedded in log file , for eg, Dec 04
> > 19:57:21 and Dec 04 19:59:30 in above log file. How can exatrct this
> > information using shell script ?
> >

>
> Which of the various time fields above is the "runtime"?
>
> Ed



Ed,
various "runtime" are : Dec 0419:57:21 and Dec 04 19:59:30 ( in above
file )

  Réponse avec citation
Vieux 05/12/2006, 08h25   #4
Bo Yang
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Extract runtime from logfile

romy :
> Hello friends,
>
> I want to extract the runtime information from log file. The log file
> looks like this :
>
> LOG FILE :
>
> --------------------------------------------------------------------------------
> Dec 04 19:57:21 Phase 0 ended (126 seconds)
> CPU Time Status Skew Vertex
> 1.810 [ : 1] 0%
> --------------------------------------------------------------------------------
> 1.810 [ : 1] 0%
> --------------------------------------------------------------------------------
> Data Bytes Records Status Skew Flow Vertex
> Port
> --------------------------------------------------------------------------------
> --------------------------------------------------------------------------------
> Dec 04 19:59:30 Phase 1 started (0 seconds)
> CPU Time Status Skew Vertex
> 0.000 [ 1: ] 0%
> 0.010 [ 1: ] 0%
> --------------------------------------------------------------------------------
> Data Bytes Records Status Skew Flow Vertex
> Port
> --------------------------------------------------------------------------------
>
>
> And the runtime information is embedded in log file , for eg, Dec 04
> 19:57:21 and Dec 04 19:59:30 in above log file. How can exatrct this
> information using shell script ?
>

I think you can match the format of your date
Dec 04 19:57:21

cat file | sed -n 's/\([A-Z][a-z]\{2\} [0-9]\{2\}
[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}\).*/\1/p'

OK
  Réponse avec citation
Vieux 05/12/2006, 22h42   #5
romy
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Extract runtime from logfile


> cat file | sed -n 's/\([A-Z][a-z]\{2\} [0-9]\{2\}
> [0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}\).*/\1/p'
>
> OK


Solves my problem..Thanks

  Réponse avec citation
Vieux 06/12/2006, 08h19   #6
Tintin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Extract runtime from logfile


"romy" <rave25@gmail.com> wrote in message
news:1165358551.472998.176870@j44g2000cwa.googlegr oups.com...
>
>> cat file | sed -n 's/\([A-Z][a-z]\{2\} [0-9]\{2\}
>> [0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}\).*/\1/p'
>>
>> OK

>
> Solves my problem..Thanks
>


Except for the UUOC



--
Posted via a free Usenet account from http://www.teranews.com

  Réponse avec citation
Vieux 06/12/2006, 14h45   #7
Bo Yang
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Extract runtime from logfile

Tintin :
> "romy" <rave25@gmail.com> wrote in message
> news:1165358551.472998.176870@j44g2000cwa.googlegr oups.com...
>>> cat file | sed -n 's/\([A-Z][a-z]\{2\} [0-9]\{2\}
>>> [0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}\).*/\1/p'
>>>
>>> OK

>> Solves my problem..Thanks
>>

>
> Except for the UUOC


What UUOC, thank you!
  Réponse avec citation
Vieux 06/12/2006, 15h19   #8
Chris F.A. Johnson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Extract runtime from logfile

On 2006-12-06, Bo Yang wrote:
> Tintin :
>> "romy" <rave25@gmail.com> wrote in message
>> news:1165358551.472998.176870@j44g2000cwa.googlegr oups.com...
>>>> cat file | sed -n 's/\([A-Z][a-z]\{2\} [0-9]\{2\}
>>>> [0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}\).*/\1/p'
>>>>
>>>> OK
>>> Solves my problem..Thanks
>>>

>>
>> Except for the UUOC

>
> What UUOC, thank you!


Useless use of cat.

--
Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h57.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,15305 seconds with 16 queries