Current location: Hot Scripts Forums » Programming Languages » Perl » perl file to parse


perl file to parse

Reply
  #1 (permalink)  
Old 04-14-10, 05:34 AM
eddiet610 eddiet610 is offline
New Member
 
Join Date: Apr 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
perl file to parse

Hi Guys
I'm a complete noob at this so here goes I'm looking to run a perl scrip that grabs content from a remote server file and creates a separate output file for each instance
currently my script is connecting via telnet and that bit is working fine, the remote dir is "/home/webapps/mist/htdocs/mist_logs/full" I want to be able to specify a date input from the user so the correct file is searched for example the file name for Apr 2010 is "mist_log.201004" so input just needs to be year and month.also a line count for each instance as a sanity check might be good...

use Net::Telnet;
$telnet = new Net::Telnet ( Timeout=>10,
Errmode=>'die');
$telnet->waitfor('/$ $/i');
$telnet->open('server.path.com');
$telnet->login('USERID', 'PW');
local dir path /home/webapps/mist/htdocs/mist_logs/full/

then search the file "mist_log.201004" for these 3 strings

"WAS61/DB2 dhebpwas01/dhebpdb201 comexp"
"WAS6/DB2 steamboat/zirkel comexp"
"WAS61/DB2 dhebpwas01/dhebpdb201 HRS"

so the output needs to be in 3 seperate files

EVS_DHE<date>.txt for WAS61/DB2 dhebpwas01/dhebpdb201 comexp
EVS_non_DHE<date>.txt for WAS6/DB2 steamboat/zirkel comexp
and
HRS<date>.txt for WAS61/DB2 dhebpwas01/dhebpdb201 HRS

an example of HRS<date>.txt is below


thanks!!
eddie

"03/01/2010","00:00","WAS61/DB2 dhebpwas01/dhebpdb201 HRS","up"
"03/01/2010","00:15","WAS61/DB2 dhebpwas01/dhebpdb201 HRS","up"
"03/01/2010","00:30","WAS61/DB2 dhebpwas01/dhebpdb201 HRS","up"
"03/01/2010","00:45","WAS61/DB2 dhebpwas01/dhebpdb201 HRS","up"
"03/01/2010","01:00","WAS61/DB2 dhebpwas01/dhebpdb201 HRS","up"
"03/01/2010","01:15","WAS61/DB2 dhebpwas01/dhebpdb201 HRS","up"
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl subsititution on Windows kenkanya Perl 3 07-28-09 12:23 AM
Manipulating a .txt file with Perl thabo Perl 5 04-03-09 10:35 AM
Hello all, can you help me? K4ot1K Other Languages 2 01-23-09 05:23 AM
Help with my largest perl script. Grabbing data from a file. Sunnmann Perl 2 04-23-08 03:27 AM
Perl Script to parse 1 xml file into many flsh Perl 0 08-09-04 10:21 AM


All times are GMT -5. The time now is 04:55 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.