The UNIX and Linux Forums  


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
simultaneously create three empty files? na5m Shell Programming and Scripting 4 06-14-2008 01:20 PM
How to parse 2 files simultaneously Awanka Shell Programming and Scripting 8 04-12-2007 09:00 PM
cp & mkdir simultaneously enuenu UNIX for Dummies Questions & Answers 5 03-13-2007 05:29 AM
Running 2 apaches simultaneously sx3v1l_1n51de SUN Solaris 2 07-22-2005 11:56 AM
tailing logs squeakywheel UNIX for Dummies Questions & Answers 1 07-05-2004 03:22 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-21-2009
Dabheeruz Dabheeruz is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 19
Tailing 2 or more log files simultaneously PERL

Hi,

I am having issue where I have to tail 3 log files continuously (forever) and while I am reading the files , parse them and shove the data into DB. I can do this with one file totally fine but how can I read 3 files at the same time? I am not really looking for code (but would be nice) but maybe a brief summary of the solution.

Btw: I am doing this in perl.

Any help is highly appreciated

Thx.
  #2 (permalink)  
Old 04-21-2009
EagleFlyFree EagleFlyFree is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 13
How about separate threads for each file? No idea about threading support in Perl though.
  #3 (permalink)  
Old 04-21-2009
giannicello giannicello is offline
Registered User
  
 

Join Date: Sep 2001
Location: Phoenix
Posts: 169
Not sure how to do it in perl but in shell scripting, I'd create a function that would read/parse the file:


Code:
parseFile () {
  fileNm=$1
  do something...
}

then I would call the function all at once in the script...


Code:
parseFile "file1" &
parseFile "file2" &
parseFile "file3" &

wait

etc.

Gianni
  #4 (permalink)  
Old 04-22-2009
Dabheeruz Dabheeruz is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 19
I am looking at forking out multiple threads but don't know how well(or not) they will work for my problem.

Thx all.
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 09:06 AM.


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