Sponsored Content
Top Forums UNIX for Advanced & Expert Users Shell script to append a time for the existing error log file Post 302125564 by gsprasanna on Friday 6th of July 2007 01:51:58 AM
Old 07-06-2007
Shell script to append a time for the existing error log file

Hi Guys,

the requirement is like this,
i am having a error log file in this format,


[INFO ][memory ] 4594.493: parallel nursery GC 2594592K->2544691K (2969600K), 30.848 ms
[INFO ][memory ] 4605.958: parallel nursery GC 2634887K->2584986K (2969600K), 38.900 ms
[INFO ][memory ] 4619.079: parallel nursery GC 2822555K->2774812K (2969600K), 51.526 ms
[INFO ][memory ] 4623.784: parallel nursery GC 2911872K->2862488K (2969600K), 43.049 ms
[INFO ][memory ] 4634.298: parallel nursery GC 2964037K->2915007K (2969600K), 44.723 ms
[INFO ][memory ] 4642.754-4644.124: GC 2969600K->745408K (2969600K), 1369.515 ms
[INFO ][memory ] 4657.312: parallel nursery GC 843925K->792192K (2969600K), 59.318 ms
[INFO ][memory ] 4667.661: parallel nursery GC 1023736K->973165K (2969600K), 54.639 ms
[INFO ][memory ] 4683.479: parallel nursery GC 1079790K->1028927K (2969600K), 57.430 ms
[INFO ][memory ] 4703.120: parallel nursery GC 1155728K->1104405K (2969600K), 48.580 ms
[INFO ][memory ] 4721.076: parallel nursery GC 1381399K->1331594K (2969600K), 67.131 ms
[INFO ][memory ] 4733.124: parallel nursery GC 1615502K->1565673K (2969600K), 67.668 ms
[INFO ][memory ] 4735.932: parallel nursery GC 1868345K->1818182K (2969600K), 60.527 ms
[INFO ][memory ] 4740.485: parallel nursery GC 1904639K->1852524K (2969600K), 39.426 ms
[INFO ][memory ] 4748.902: parallel nursery GC 1931641K->1880332K (2969600K), 45.826 ms
[INFO ][memory ] 4749.369: parallel nursery GC 1992582K->1939949K (2969600K), 40.806 ms
[INFO ][memory ] 4754.434: parallel nursery GC 2180168K->2130041K (2969600K), 49.643 ms
[INFO ][memory ] 4773.739: parallel nursery GC 2184441K->2132628K (2969600K), 47.404 ms
[INFO ][memory ] 4793.466: parallel nursery GC 2488886K->2439957K (2969600K), 65.046 ms
[INFO ][memory ] 4825.436: parallel nursery GC 2539740K->2489040K (2969600K), 57.110 ms
[INFO ][memory ] 4829.277: parallel nursery GC 2668261K->2617286K (2969600K), 44.117 ms
[INFO ][memory ] 4835.849: parallel nursery GC 2671686K->2619201K (2969600K), 37.932 ms
[INFO ][memory ] 4849.233: parallel nursery GC 2781360K->2730476K (2969600K), 47.521 ms
[INFO ][memory ] 4870.198: parallel nursery GC 2902826K->2851834K (2969600K), 56.248 ms
[INFO ][memory ] 4873.277-4874.744: GC 2947600K->754541K (2969600K), 1467.026 ms
[INFO ][memory ] 4876.460: parallel nursery GC 824428K->769741K (2969600K), 146.708 ms
[INFO ][memory ] 4888.450: parallel nursery GC 916812K->862855K (2969600K), 46.349 ms
[INFO ][memory ] 4902.871: parallel nursery GC 992190K->936997K (2969600K), 30.377 ms
[INFO ][memory ] 4907.508: parallel nursery GC 1167917K->1115851K (2969600K), 63.247 ms
[INFO ][memory ] 4933.191: parallel nursery GC 1293112K->1239053K (2969600K), 51.764 ms
[INFO ][memory ] 4939.716: parallel nursery GC 1339610K->1284920K (2969600K), 41.355 ms



this file will go on displaying all the nursery GC, only 'GC'.



the main aim is that , error log file goes on generating output from weblogic as shown above, we want to take the timespan between two GC's

i.e
[INFO ][memory ] 4642.754-4644.124: GC 2969600K->745408K (2969600K), 1369.515 ms


so i want a script to append time at the end of the line i.e after 'ms'



so will anyone help me out with a script for the above requirement
(atleast suggestions are welcomed)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

script to run shell command and insert results to existing xml file

Hi. Thanks for any help with this. I'm not new to programming but I am new to shell programming. I need a script that will 1. execute 'df -k' and return the volume names with specific text 2. surround each line of the above results in opening and closing xml tags 3. insert the results of step... (5 Replies)
Discussion started by: littlejon
5 Replies

2. UNIX for Dummies Questions & Answers

Inserting Date&Time Stamp In Existing Log File

I am trying to insert a line with a date stamp in a file that is used to monitor activity in one of our directories. By doing this, I want to grep that file each day and go to the last entry for each time a error occurred and pull all errors generated if any exist. If error exists I want that error... (3 Replies)
Discussion started by: shephardfamily
3 Replies

3. Shell Programming and Scripting

shell script not getting current error messages with time from alert.log

Hi All, I need to get current error messages with time from alert.log.Below is my shell script but it's not working to meet this objective. could anyone pls share on the above issue for resolution: #################################################################### ## ckalertlog.sh ##... (2 Replies)
Discussion started by: a1_win
2 Replies

4. Shell Programming and Scripting

shell script to read a line in gps receiver log file and append that line to new file

Hi, I have gps receiver log..its giving readings .like below Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GPSD,R=1 $GPGSV,3,1,11,08,16,328,40,11,36,127,00,28,33,283,39,20,11,165,00*71... (3 Replies)
Discussion started by: gudivada213
3 Replies

5. Shell Programming and Scripting

append existing file with zeroes bsed on position

Hi i am trying to append value with 0 to an existing file in the position 50-56 & 58-64 only where empty space is there Rule: 1 row already has some value and i do not want to change anything for this row. 2nd record below you see the position 50-64 is empty, i want to replace with 0000000... (3 Replies)
Discussion started by: kshuser
3 Replies

6. Shell Programming and Scripting

How to append value at first line of CSV file using shell script?

I have an issue where I need to append a value at the last of the csv, I have created a shell script and it is appending the columns at the last but it is appending at all lines, and my requirement is specific to just append at the 1st line. Have a look and suggest, (7 Replies)
Discussion started by: anujrichhariya
7 Replies

7. Shell Programming and Scripting

Append files to a existing tar file.

Hi all, I want to check whether tar file exists in the directory or not. If tar file exists in the directory then I want to append the files to it. I am using the below command to tar files if the file does not exist. tar zcvf <tar file name> <Files to append> However, if want to... (4 Replies)
Discussion started by: Nagaraja Akkiva
4 Replies

8. Shell Programming and Scripting

Shell Script | Parse log file after a given date and time stamp

I am developing one script which will take log file name, output file name, date, hour and minute as an argument and based on these inputs, the script will scan and capture all the error(s) that have been triggered from a given time. Example: script should capture all the error after 13:50 on Jan... (2 Replies)
Discussion started by: ROMA3
2 Replies

9. Shell Programming and Scripting

Append date to sql*plus spool (log) file in shell script

SQL*Plus version : 11.2.0.4 OS : Oracle Linux 6.5 SQL*Plus is a client application to connect to oracle database. The log file for this tool is generated via spool command as shown below. I am trying to append date ( $dateString ) to spool file as shown below. $ cat test2.sh #!/bin/bash... (4 Replies)
Discussion started by: kraljic
4 Replies

10. Shell Programming and Scripting

Need shell script to append double quotes for each column in a file

Hi Experts, I am beginner to the shell scripting, My requirement is to append double quotes for each column in a file if double quotes does not exist. Example: "abc"|123|"gh-ch"|23.067 Use code tags, thanks. (10 Replies)
Discussion started by: spidy
10 Replies
PARPORT_REGISTER_POR(9) 				       Parallel Port Devices					   PARPORT_REGISTER_POR(9)

NAME
parport_register_port - register a parallel port SYNOPSIS
struct parport * parport_register_port(unsigned long base, int irq, int dma, struct parport_operations * ops); ARGUMENTS
base base I/O address irq IRQ line dma DMA channel ops pointer to the port driver's port operations structure DESCRIPTION
When a parallel port (lowlevel) driver finds a port that should be made available to parallel port device drivers, it should call parport_register_port. The base, irq, and dma parameters are for the convenience of port drivers, and for ports where they aren't meaningful needn't be set to anything special. They can be altered afterwards by adjusting the relevant members of the parport structure that is returned and represents the port. They should not be tampered with after calling parport_announce_port, however. If there are parallel port device drivers in the system that have registered themselves using parport_register_driver, they are not told about the port at this time; that is done by parport_announce_port. The ops structure is allocated by the caller, and must not be deallocated before calling parport_remove_port. If there is no memory to allocate a new parport structure, this function will return NULL. COPYRIGHT
Kernel Hackers Manual 3.10 June 2014 PARPORT_REGISTER_POR(9)
All times are GMT -4. The time now is 12:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy