![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| append newline to existing variables | finalight | Shell Programming and Scripting | 1 | 05-21-2008 05:07 AM |
| Shell Script --- Delete ORA error from data file | sk005 | UNIX for Dummies Questions & Answers | 1 | 09-25-2007 05:26 PM |
| Need a script to Append date to generated .txt file | prince_of_focus | Shell Programming and Scripting | 2 | 08-01-2006 02:51 PM |
| Inserting Date&Time Stamp In Existing Log File | shephardfamily | UNIX for Dummies Questions & Answers | 3 | 02-24-2006 04:01 AM |
| script to run shell command and insert results to existing xml file | littlejon | Shell Programming and Scripting | 5 | 08-12-2005 04:59 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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) |
|
||||
|
[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 so here one thing to know is : main GC = [INFO ][memory ] 4642.754-4644.124: GC 2969600K->745408K (2969600K), 1369.515 ms nursery GC= [INFO ][memory ] 4657.312: parallel nursery GC 843925K->792192K (2969600K), 59.318 ms so i want to append time to the above data, and the output should be: [INFO ][memory ] 4642.754-4644.124: GC 2969600K->745408K (2969600K), 1369.515 ms 23:19:32 2007 i.e at the end of the above line it is appended by time as 23:19:32 2007 |
|
||||
|
i had written a script ,
tail -f /filers/f08-perf01/logFiles/wcluster/websites01-perf-1-8901/NodeManagerLogs/cobaltgroup_websites01-perf-1-8901/websites01-perf-1-8901_error.log |grep -v nursery > /home/readonly/g2 date "+%H:%M:%S" >> /home/readonly/g2 cat /home/readonly/g2 or cd /filers/f08-perf01/logFiles/wcluster/websites01-perf-1-8901/NodeManagerLogs/cobaltgroup_websites01-perf-1-8901/ v1=`tail -f websites01-perf-1-8901_error.log|grep -ivn 'nursery'` v2=`date "+%H:%M:%S"` echo $v1 $v2 given executable permission to the file also, but still unable to print the output as [INFO ][memory ] 4642.754-4644.124: GC 2969600K->745408K (2969600K), 1369.515 ms 23:19:32 2007 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|