Sponsored Content
Top Forums Shell Programming and Scripting Need Suggestion, on how to constantly moniter a file and display content with in that time Post 302880243 by manas_ranjan on Wednesday 18th of December 2013 10:24:59 AM
Old 12-18-2013
Need Suggestion, on how to constantly moniter a file and display content with in that time

Dear Gurus,

I'm in a strange situation, hence need some kind of advice or possible syntax to carry on.

let's say
Code:
current time/date is 2013-12-18, 15:58:15

I got a file something like this, which keep getting updated with respect to time.

Code:
2013-12-18, 15:56:15,[http-3],USERNAME,SUCCESS,DURATION,815,EXECUTE,CELLS,1736
2013-12-18, 15:57:15,[http-3],USERNAME,SUCCESS,DURATION,815,EXECUTE,CELLS,1736
2013-12-18, 15:58:15,[http-3],USERNAME,SUCCESS,DURATION,815,EXECUTE,CELLS,1736
2013-12-18, 15:59:15,[http-3],USERNAME,SUCCESS,DURATION,815,EXECUTE,CELLS,1736
2013-12-18, 14:15:15,[http-3],USERNAME,SUCCESS,DURATION,815,EXECUTE,CELLS,1736
2013-12-18, 14:23:15,[http-3],USERNAME,SUCCESS,DURATION,815,EXECUTE,CELLS,1736

So, now I will run the script then it should sum the duration in my file from (current time - 5mins)
hence it should sum

Code:
2013-12-18, 15:56:15,[http-3],USERNAME,SUCCESS,DURATION,815,EXECUTE,CELLS,1736
2013-12-18, 15:57:15,[http-3],USERNAME,SUCCESS,DURATION,815,EXECUTE,CELLS,1736
2013-12-18, 15:58:15,[http-3],USERNAME,SUCCESS,DURATION,815,EXECUTE,CELLS,1736
2013-12-18, 15:59:15,[http-3],USERNAME,SUCCESS,DURATION,815,EXECUTE,CELLS,1736

so every time if it runs then that moment it will go to file and subtract 5 mins from the current system time and only display sum of duration falling this time range(i.e. with in system date and system date - 5mins).

I would like to make in UNIX scripting.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

file display on screen on pg at time

hi can some body please help me...i'm been sitting here trying to figure how to do this..but still don't understand. Like each type of *.src (if any) in the given directory will be displayed on the screen one page at a time.... can someone explain how to do this..plz (1 Reply)
Discussion started by: zip_zip
1 Replies

2. UNIX for Dummies Questions & Answers

grep/cat/more -- search in a txt file and display content from a specific "keyword"

Hi, I have a .txt file Sample: ===================== NEXT HOST ===================== AEADBAS001 ip access-list extended BLA_Incoming_Filter ip access-list extended BLA_Outgoing_Filter access-list 1 permit xxxxxxxxxxxxxx access-list 2 permit xxxxxxxxxxxxxx =====================... (4 Replies)
Discussion started by: I-1
4 Replies

3. Shell Programming and Scripting

Pattern matching in file and then display 10 lines above every time

hiii, i have to write a shell script like this---- i have a huge log file name abc.log .i have to search for a pattern name "pattern",it may occur 1000 times in the log file,every time it finds the pattern it should display the 10 lines above the pattern. I appericiate your help. (30 Replies)
Discussion started by: namishtiwari
30 Replies

4. UNIX for Dummies Questions & Answers

Display message on screen and flat file at same time

Hi guys, I have a script that call another, the other displays de message and I can print directly to the flat file, but in one command I am searchig that this message can be displayed in the screen and in the flat file in one command. I am doing something like this: var=$(./Example.sh)... (2 Replies)
Discussion started by: pipoca
2 Replies

5. UNIX for Dummies Questions & Answers

Display the content of the unix file

cat is the normal unix command to display the content of a file. Is there any program to display the content of the file. If there is, then can you send me the code. (5 Replies)
Discussion started by: vedanjalig
5 Replies

6. Shell Programming and Scripting

Grep the Content of a LOG File which has latest Date and Time

Hi All, Need a small help. I have a log file which keeps updating for every Minute with multiple number of lines. I just want to grep few properties which has latest Date and Time to it. How do i do it? I wanted to grep a property by name "Reloading cache with a maximum of" from the... (4 Replies)
Discussion started by: nvindraneel
4 Replies

7. Shell Programming and Scripting

Display specific lines content from the file

Hell, I want to grep certain word from file and display above 2 lines and after two lines. Here is the content of sample file. Mar 14, 2013 12:56:59 AM Agent.Agent SendTo INFO: Connection to server:7041 - Credential Transmit Successesful Mar 14, 2013 8:54:21 AM cgent SendTo WARNING:... (7 Replies)
Discussion started by: balareddy
7 Replies

8. Shell Programming and Scripting

Grep to display file name along with content in Solaris

Am using the following grep to match a particular patter in grep. grep xyz abc.txt now while i run this command, if the pattern matched, am getting the line containing xyz Output: xyz is doing some work Now if i want the file name also along with my output, what should i do Expected... (2 Replies)
Discussion started by: rituparna_gupta
2 Replies

9. Shell Programming and Scripting

Long list file display different time format.

Hi Gurus, I have some weird issue. when using ls -l the result shows different time format: -rw-r--r-- 1 abc gourp1 3032605576 Jun 14 2013 abc -rw-rw-r-- 1 abc gourp1 1689948832 Aug 10 06:22 abc one display 2013 which is year; another one displays 06:22 which is time. ... (4 Replies)
Discussion started by: ken6503
4 Replies

10. Shell Programming and Scripting

Moniter files and merge

Hi All, I have a requirement where I need to monitor the files in a directory for 15 secs and if the size of the files are not changing within that time I would like to merge all the data in those files and move it to another directory with a time stamp For eg dir1 I have 10 files and... (2 Replies)
Discussion started by: Tomlight
2 Replies
EXECUTE(7)                                                         SQL Commands                                                         EXECUTE(7)

NAME
EXECUTE - execute a prepared statement SYNOPSIS
EXECUTE name [ ( parameter [, ...] ) ] DESCRIPTION
EXECUTE is used to execute a previously prepared statement. Since prepared statements only exist for the duration of a session, the pre- pared statement must have been created by a PREPARE statement executed earlier in the current session. If the PREPARE statement that created the statement specified some parameters, a compatible set of parameters must be passed to the EXECUTE statement, or else an error is raised. Note that (unlike functions) prepared statements are not overloaded based on the type or number of their parameters; the name of a prepared statement must be unique within a database session. For more information on the creation and usage of prepared statements, see PREPARE [prepare(7)]. PARAMETERS
name The name of the prepared statement to execute. parameter The actual value of a parameter to the prepared statement. This must be an expression yielding a value that is compatible with the data type of this parameter, as was determined when the prepared statement was created. OUTPUTS
The command tag returned by EXECUTE is that of the prepared statement, and not EXECUTE. EXAMPLES
Examples are given in the Examples [prepare(7)] section of the PREPARE [prepare(7)] documentation. COMPATIBILITY
The SQL standard includes an EXECUTE statement, but it is only for use in embedded SQL. This version of the EXECUTE statement also uses a somewhat different syntax. SEE ALSO
DEALLOCATE [deallocate(7)], PREPARE [prepare(7)] SQL - Language Statements 2010-05-14 EXECUTE(7)
All times are GMT -4. The time now is 10:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy