The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
Shell script to search for text in a file and copy file imeadows UNIX for Dummies Questions & Answers 9 11-12-2008 09:12 PM
Copy lines from a log file based on timestamp ranjiadmin UNIX for Advanced & Expert Users 1 05-22-2008 03:16 AM
copy lines from opne file to another HIMANI UNIX for Dummies Questions & Answers 2 03-15-2008 05:57 AM
How to copy multiple lines from a file to another using AWK? jisha Shell Programming and Scripting 3 01-08-2008 01:04 AM
Copy only the initial 10 lines from a file to another jockey007 Shell Programming and Scripting 5 11-02-2007 02:05 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-27-2008
fara_aris fara_aris is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 27
Script to capture new lines in a file and copy it to new file

Hi All,
I have a file that gives me new line/output every 5 minutes. I need to create a script that capture new line/output besides "IN CRON_STATUS", in this case the new output is "begin ------ cron_status.sh - [started] -----------".

I want this script to capture the line starting from "begin ------ cron_status.sh - [started] -----------" until it reads "IN CRON_STATUS" again. If the script notice the "IN CRON_STATUS", it will stop capturing and direct the output to a different file name and rename it to the original name but with timestamp.

Sample;
---------05/21/08-05:00:00-------- IN CRON_STATUS -----------------------------------
---------05/21/08-05:00:00-------- IN CRON_STATUS -----------------------------------
---------05/21/08-05:05:00-------- IN CRON_STATUS -----------------------------------
---------05/21/08-05:05:00-------- IN CRON_STATUS -----------------------------------
---------05/21/08-05:15:00-------- IN CRON_STATUS -----------------------------------
--------------------------------------- begin ------ cron_status.sh - [started] -----------

- Message Started found in /RCEBTM_appli/RCEBMA/mbox/hubftpa
- Starting Tuxedo
---------05/21/08-05:15:00-------- IN CRON_STATUS -----------------------------------
---[CRON]---05/21/08-05:15:00-------- Message Started found in /RCEBTM_appli/RCEBMA/log
---[CRON]---05/21/08-05:15:00-------- Starting RCE
---[CRON]---05/21/08-05:15:00-------- Starting RCE servers ...
XXXXX.XXXXX!BBL.21394: 052108: TUXEDO Version 6.5 HP-UX B.11.00 U XXXX/XXXXXXX unlimited-user license.
- sending file with ftp: success
---------05/21/08-19:55:00-------- IN CRON_STATUS -----------------------------------
---------05/21/08-19:55:00-------- IN CRON_STATUS -----------------------------------
---------05/21/08-20:00:00-------- IN CRON_STATUS -----------------------------------


Please advise.

Thank you in advance.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:39 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0