Mombu the Programming Forum

Go Back   Mombu the Programming Forum > Programming > Modify timestamp in the log file
User Name
Password
REGISTER NOW! Mark Forums Read




Reply Bookmark and Share
1 11th September 04:23
thuang2
External User
 
Posts: 1
Default Modify timestamp in the log file



Hi,

My shell script (bash) does some queries every hour and append result
of the query to a log file. If there is no result, the query would
return something like "Query has no entries." If the previous hour's
query result is also "Query has no entries," then instead of appending
the result, the script only modifies the timestamp for the last "Query
has no entries" section in the log file.

The log file looks like this:

############
Query time - May 8 07:59:14 PDT 2006

Query has no entries
############
Query time - May 8 08:59:14 PDT 2006
[Some content here]
....
############
Query time - May 8 09:59:14 PDT 2006

Query has no entries

In this case, the script needs to check whether the last entry in the
log file is "Query has no entries" and if it is, the script needs to
modify the timestamp (i.e. "May 8 09:59:14 PDT 2006") in the last
"Query has no entries" section? Is there any way to do that using awk
or sed? Thanks.
  Reply With Quote


 


Reply


Thread Tools
Display Modes


Some other forums that might be of your interest : Development, Ada, Apple script, Assembler, Awk, Beos, Basic, C, C++, C#, C# .net, .net, .net frameworks, Asp .net, Clarion, Clipper, Clos, Clu, Cobol, Coldfusion, Delphi, Dylan, Eiffel, Forth, Fortran, Haskell, Hermes, Icon, Idl, Java, Java script, Jscript .net, Jcl, Linoleum, Lisp, Lotus, Limbo, Logo, Ml, Mumps, Oberon, Postscript, Pop, Pl1, Prolog, Python, Ruby, Pascal, Perl, Php, Rebol, Rexx, Sed, Sather, Scheme, Smalltalk, Tcl, Vhdl, Vrml, Visual basic, Visual basic .net, Yorick, Mysql, Omnis, Postgresql, Xbase, Access, Oracle, Adabas, Berkeley, Btrieve, Filemaker, Gupta, Db2, Informix, Ingres, Mssql server, Object, Olap, Paradox, Rdb, Revelation, Sybase, Theory, Dbase, Html, Java script, Css, Flash, Photoshop, Corel script, Xml, Tech, Beos, Gem, Hp48, Hpux, Linux, Mac, Ms-dos, Os2, Palm, Solaris, Ti99, Windows, Xenix, Aos, Chorus, Geos, Inferno, Lantastic, Lynx, Mach, Minix, Netware, Os9, Parix, Plan9, Psos, Qnx, Xinu, Sco, Unix, Aix, Aux, 386bsd, Bsdi, Freebsd, Netbsd, Openbsd, Ultrix, Amd, Intel, Aptiva, Buz, Deals, Homebuilt, Overclocking, Programming, Extra forums


Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666