![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Writing a shell in Python | sadistik_exec | High Level Programming | 1 | 08-15-2008 03:22 AM |
| seeking help with shell script | Niadh | Shell Programming and Scripting | 4 | 10-17-2007 10:17 AM |
| Difference between writing Unix Shell script and AIX Shell Scripts | haroonec | AIX | 0 | 04-12-2006 03:27 AM |
| Need help for writing shell script | deepa20 | Shell Programming and Scripting | 3 | 02-01-2006 01:23 PM |
| Is writing shell scripts different than... | brentdeback | Shell Programming and Scripting | 1 | 10-28-2005 10:20 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi All, I got a problem and stuck to filter a log file, called it as "sample.log". This "sample.log" file is being generated by "script A". The "sample.log" look like below: Code:
:FORMATDATE_FORMATTIME:CmdArg->:SomeDoce:SomeFormatDocument: :FORMATDATE_FORMATTIME:imprtcp succeeded. :FORMATDATE_FORMATTIME:imprttyp completed. :FORMATDATE_FORMATTIME:fdcode2 failed :: ::........................... :FORMATDATE_FORMATTIME:CmdArg->:SomeDoce:SomeFormatDocument: :FORMATDATE_FORMATTIME:imprtcp succeeded. :FORMATDATE_FORMATTIME:imprttyp completed. :FORMATDATE_FORMATTIME:DocCode = yadayada(00) :FORMATDATE_FORMATTIME:Document type is yada. :FORMATDATE_FORMATTIME:Document not paginated or not text. :FORMATDATE_FORMATTIME:yada yada succeeded. :FORMATDATE_FORMATTIME:yada yada succeeded, size=1248. :FORMATDATE_FORMATTIME:nimport succeeded. What i try to do is,Since the "sample.log" is actively growing up. i need to 1) Grep the the value failed and also all the required data. i should get like below:- Code:
:FORMATDATE_FORMATTIME:CmdArg->:SomeDoce:SomeFormatDocument: :FORMATDATE_FORMATTIME:imprtcp succeeded. :FORMATDATE_FORMATTIME:imprttyp completed. :FORMATDATE_FORMATTIME:fdcode2 failed 2) and email it to the me as an alert. P/S this script will run in cron to actively monitor the "failed" data. May be somebody cay help me on figure it out how can i do this. Currently what i have is: 1) tail -f sample.log | grep failed >> samplelog.failed ## but i stuck at here because tail -f cannot output to other files, i tried but failed, no output has been generate. 2) test=$(cat samplelog.failed | cut -d: -f-2) cat sample.log | grep $test: | /usr/bin/mailx -s "Subject" to@somebody Thanks for your helping in here. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|