help in hour grep


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting help in hour grep
# 1  
Old 01-31-2008
help in hour grep

i have this script that checks for yesterday date and also specific hour in that

-----------------------------------------------------------------


TZ=`date +%Z`+24 ;a=`date +%Y-%m-%d %k`
cd logs
count=0
for i in DBMaint.log
do

cat $i | grep $a >> file12.txt
done
----------------------------------------------------------------

here k=hour which i want to set it to 22.how to do that.

actually i want to grep yesterday date and in that 22nd hour ,so how to specify that in below command


TZ=`date +%Z`+24 ;a=`date +%Y-%m-%d %k`
------------------------------------------------------------
how to set the desired value in above command for hour

Last edited by ali560045; 01-31-2008 at 03:59 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep lines between last hour timestamp and current timestamp

So basically I have a log file and each line in this log file starts with a timestamp: MON DD HH:MM:SS SEP 15 07:30:01 I need to grep all the lines between last hour timestamp and current timestamp. Then these lines will be moved to a tmp file from which I will grep for particular strings. ... (1 Reply)
Discussion started by: nms
1 Replies

2. Shell Programming and Scripting

Grep in a log file within a time range (hour)

Hi, im trying to write a grep script that returns me the last inputs added in the last hour in the log file. Literally i have nothing yet but: grep 'Line im looking for' LOGFILE.log | tail -1 this only gives me the last input, but no necessarily from the last hour. Help Please. (4 Replies)
Discussion started by: blacksteel1988
4 Replies

3. Shell Programming and Scripting

How to get next hour?

Hi guys I want any script to get me next hour For example Nexthour.sh 2013022823 It get me result 2013030100 Thanks a lot , I'm using Solaris 10 (5 Replies)
Discussion started by: teefa
5 Replies

4. Shell Programming and Scripting

How to convert 24 hour time to 12 hour timing?

Hi friends, I want to convert 24 hour timing to 12 hour please help me... my data file looks like this.. 13-Nov-2011 13:27:36 15.32044 72.68502 13-Nov-2011 12:08:31 15.31291 72.69807 16-Nov-2011 01:16:54 15.30844 72.74028 15-Nov-2011 20:09:25 15.35096 ... (13 Replies)
Discussion started by: nex_asp
13 Replies

5. UNIX for Advanced & Expert Users

Finding/Grep on files with date and hour in the file name

Hi, I have a folder structure as follows, DATA -> 2012-01-01 -> 00 -> ABC_2012-01-03_00.txt -> 01 -> ABC_2012-01-03_01.txt -> 02 -> ABC_2012-01-03_02.txt ... -> 23 -> ABC_2012-01-03_02.txt -> 2012-01-02 ... (1 Reply)
Discussion started by: mihirvora16
1 Replies

6. Shell Programming and Scripting

Finding/Grep on files with date and hour in the file name

Hi, I have a folder structure as follows, DATA -> 2012-01-01 -> 00 -> ABC_2012-01-03_00.txt -> 01 -> ABC_2012-01-03_01.txt -> 02 -> ABC_2012-01-03_02.txt ... -> 23 -> ABC_2012-01-03_02.txt -> 2012-01-02 -> 2012-01-03 So the dir DATA contains the above hierarchy, User input Start and... (6 Replies)
Discussion started by: mihirvora16
6 Replies

7. Shell Programming and Scripting

Grep string from logs of last 1 hour on files of 2 different servers and calculate count

Hi, I am trying to grep a particular string from the files of 2 different servers without copying and calculate the total count of its occurence on both files. File structure is same on both servers and for reference as follows: 27-Aug-2010... (4 Replies)
Discussion started by: poweroflinux
4 Replies

8. Shell Programming and Scripting

How can i grep for an hour before data

Hi, My log file is something like this. (08/04/2009 00:27:42.179)(:) aaaaaaaaaaaa (08/04/2009 00:27:42.181)(:) bbbbbbbbbbbbbbbb (08/04/2009 01:00:42.713)(:) cd cdc d ddddsksjdkssksksj (08/04/2009 01:02:42.716)(:) raarrarararararara (08/04/2009 01:07:43.036)(:ERROR) Port... (8 Replies)
Discussion started by: rdhanek
8 Replies

9. UNIX for Dummies Questions & Answers

an hour less in 24 hour system

My program: __________________________________ #!/bin/ksh DAY=`date +%y%m%d` H=`date +%H` M=`date +%M` day=`date +%m/%d/%y` let h=$H-1 echo DAY $DAY echo H $H echo M $M echo day $day echo h $h _____________________________________ My result: (3 Replies)
Discussion started by: bobo
3 Replies

10. UNIX for Dummies Questions & Answers

1 Hour less

set DAY=`date +%y%m%d` set H=`date +%H` set M=`date +%M` mailx -s "$H-Mydata" myemail@mail.com<mydata I am looking to set the current hour to have 1 hour less in the subject header: For example: let's say the system time is 8 I want to have "7-Mydata" not "8-Mydata" Can some1... (6 Replies)
Discussion started by: bobo
6 Replies
Login or Register to Ask a Question
OSDClock(1)						      General Commands Manual						       OSDClock(1)

NAME
osd_clock - X on-screen clock displayer SYNOPSIS
osd_clock [OPTION]... [+FORMAT] DESCRIPTION
Display date/time information on screen. -f FONT Set font. -c COLOR Set color. -d DELAY Sets the delay (in seconds) that the clock is exposed. Useful if combined with INTERVAL. -F FORMAT This option specifies the format to be used to output the date. See 'strftime(3)'. -i INTERVAL This specifies the interval between displays. Default is 1 (display every second). -H INTEGER The "chimes per hour" count overrides -i. Default is 0 (no effect). The time will be displayed this many times each hour (notwithstanding signals interrupting sleep, and leap seconds). The first dis- play of the hour will be on the hour exactly. Use -H 4 for a display at 0, 15, 30 and 45 minutes past. -s SHADOW This option sets the shadow depth. Default 2. -t locate clock at top left (default: bottom left). -b locate clock at bottom left (default). -o OFFSET This option specifies the offset from the top or bottom of screen the text is displayed. The default is 0. Useful to move above or below panels or applets. -h, --help display this help and exit BUGS
The per-hour mode may fire up to one second late, or worse if the system is busy. AUTHOR
Jon Beckham <leftorium@leftorium.net> Martijn van de Streek <martijn@foodfight.org> Nathan Walp <faceprint@faceprint.com> COPYRIGHT
It is distributed under the GNU General Public License. X OSD Clock March 2001 OSDClock(1)