|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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 ? |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
> > 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 ) |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
> 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 |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
"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 |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
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! |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
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 |
|
![]() |
| Outils de la discussion | |
|
|