Re: [Perl-unix-users] Search for a line and print the next 5 from a file

2005-01-31 Thread Craig Sharp
escription:/){ for (my $x = 0; $x < 5; $x++) { print readline(INFILE) . "\n"; } last; } } close (INFILE); -Tim "Craig Sharp" <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 01/31/2005 09:57 AM To cc Subject [Perl-unix-use

[Perl-unix-users] Search for a line and print the next 5 from a file

2005-01-31 Thread Craig Sharp
Hi all, I know this is simple but I have having a brain lock today. I have a file in which I need to find a particular line. Once I find the line, I need to print the next 5 lines and quit. The following gets me to the line but I am stuck from there. #!/usr/bin/perl -w open (INFILE,"filemon2

[Perl-unix-users] URGENT: Launching a local Perl script on windows to run a putty / SSH login to remote server and launch an X application on the remote

2004-12-15 Thread Craig Sharp
I need to be able to do the following from a windows machine: 1. Login to remote server via putty / SSH / Perl script 2. Automatically launch a script residing on the local system to send commands to the remote host to start the proper software. Seems pretty simple except I cannot find a way to

Re: [Perl-unix-users] Urgent: Local time scalar conversion

2004-07-23 Thread Craig Sharp
sprintf did the trick! Thanks to all who responded. >>> "Craig Sharp" <[EMAIL PROTECTED]> 07/23/04 10:57AM >>> I need to get 2 digit time and date in a scalar when there is only 1 digit. Eg: Using printf with %02d, I am able to get 05 to print at 5 min pas

[Perl-unix-users] Urgent: Local time scalar conversion

2004-07-23 Thread Craig Sharp
I need to get 2 digit time and date in a scalar when there is only 1 digit. Eg: Using printf with %02d, I am able to get 05 to print at 5 min past the hour. printf("%02d",$Minute) I need to assign this output to a scalar variable so that I can use it as part of a filename later in the code.

[Perl-unix-users] System IO load testing

2004-03-18 Thread Craig Sharp
I need to come up with a way to do heavy system IO and processor load testing on a new enterprise storage and blade server combination. I would like to do this in Perl but I have no idea how or even if Perl can help me do this. The testing must load the devices to as near max as possible. Any h

[Perl-unix-users] Index of array element

2003-12-03 Thread Craig Sharp
I have an array of names. I need to find the corresponding index for a particular name. How can I do this? Thanks, Craig ___ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: [Perl-unix-users] Removing a set of consecutive file names froma directory

2003-12-01 Thread Craig Sharp
Bill, Can you please give and example? Thanks, Craig >>> "$Bill Luebkert" <[EMAIL PROTECTED]> 12/01/03 09:29AM >>> Craig Sharp wrote: > It sounds simple but here is the situation. > > I have DB2 creating log files. Each file name is consecutive

[Perl-unix-users] Removing a set of consecutive file names from a directory

2003-12-01 Thread Craig Sharp
It sounds simple but here is the situation. I have DB2 creating log files. Each file name is consecutive. Eg: S628.LOG S629.LOG S630.LOG S631.LOG S632.LOG S633.LOG S634.LOG S635.LOG S636.LOG S637.LOG S638.LOG S639.LOG S640.LOG The DBA wants m

RE: [Perl-unix-users] Removing files older than 10 days from a directory

2003-11-07 Thread Craig Sharp
Travis, The attachment did not come through. Please try again or you can just send it by email. Thanks, Craig >>> Travis Hoyt <[EMAIL PROTECTED]> 11/07/03 01:57PM >>> Here's our version for Oracle being backed up by Veritas NetBackup. I tried to just cut and paste this but it isn't keeping

RE: [Perl-unix-users] Removing files older than 10 days from a directory

2003-11-07 Thread Craig Sharp
n files here close(DIR); foreach my $file(@files) { my $now = time; my @stat = stat("$dir/$file"); if ($stat[9] < ($now - 864000)) { print "Deleting $dir/$file..."; unlink("$dir/$file"); print &qu

Re: [Perl-unix-users] Removing files older than 10 days from a directory

2003-11-07 Thread Craig Sharp
2003, at 08:00 PM, Michael A Nachbaur wrote: > On Thursday 06 November 2003 04:36 pm, Craig Sharp wrote: >> Hi, >> >> I guess the subject says it all. I have a set of directories on Unix. >> I need to remove all files that are older than 10 days from each >

[Perl-unix-users] Removing files older than 10 days from a directory

2003-11-06 Thread Craig Sharp
Hi, I guess the subject says it all. I have a set of directories on Unix. I need to remove all files that are older than 10 days from each directory. I am having a brain lock problem and cannot get started. Any ideas would be a big help. Thanks, Craig

[Perl-unix-users] Share memory examples?

2003-07-31 Thread Craig Sharp
Hi all, Can anyone send some examples of using shared memory with perl? I know there are shmctl, shmget, shmwrite, etc. I would like to see these used in practice. Thanks, Craig ___ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http:

[Perl-unix-users] Counter for console based script

2003-06-20 Thread Craig Sharp
I need to put a counter in a script that processes a file line by line. I want the counter to alway stays on the same line on the console but increment. This is to be a baby sitter so that the user can see the numbers increase. I do not want to scroll but print the number, erase and print the ne

RE: [Perl-unix-users] URGENT: Scan a directory and ftp ifthere are files

2003-06-09 Thread Craig Sharp
Jimmy -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Craig Sharp Sent: Monday, June 09, 2003 10:34 AM To: [EMAIL PROTECTED] Subject: [Perl-unix-users] URGENT: Scan a directory and ftp if there are files Hi all, I need a example of scanning a directory on a s

[Perl-unix-users] URGENT: Scan a directory and ftp if there are files

2003-06-09 Thread Craig Sharp
Hi all, I need a example of scanning a directory on a scheduled basis (crontab) for files. If there are files in the directory, those files need to be ftp'ed to a server and then deleted from the sending server. This is an automated incoming mailbox for EDI and the data needs to be transfered wh

RE: [Perl-unix-users] Setting env variables?

2002-09-05 Thread Craig Sharp
print "$ENV{Ice_Cream}{Flavors}{Favorite}\n"; > -Original Message- > From: Craig Sharp [mailto:[EMAIL PROTECTED]] > Sent: Thursday, September 05, 2002 13:28 > To: [EMAIL PROTECTED] > Subject: [Perl-unix-users] Setting env variables? > > > Hi all, > >

[Perl-unix-users] Setting env variables?

2002-09-05 Thread Craig Sharp
Hi all, I have a huge pile of environment variables to set. If I set them in a separate perl script and use the require function to reference that script, will the variables be available to the calling perl script? Thanks, Craig ___ Perl-Unix-User

[Perl-unix-users] Remove blank lines from a file

2002-08-15 Thread Craig Sharp
I have a simple question but I have brain lock. I need to parse a file and remove all blank lines from the file. Thanks, Craig ___ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: [Perl-unix-users] URGENT Regex problem

2002-07-30 Thread Craig Sharp
GOT IT! s/^\e//; Thanks for all your replies. Craig >>> "Craig Sharp" <[EMAIL PROTECTED]> 07/30/02 02:04PM >>> Hi all, I have several lines that start as follows: ^[(s3B I need to remove the ^[ from each line. Beware that there are lines in the file t

[Perl-unix-users] URGENT Regex problem

2002-07-30 Thread Craig Sharp
Hi all, I have several lines that start as follows: ^[(s3B I need to remove the ^[ from each line. Beware that there are lines in the file that do not begin as shown. Thanks, Craig A. Sharp Unix Systems Administrator DNS Administrator Roush Industries Office: 734-466-6286 Cell: 734-231-6769

RE: [Perl-unix-users] Finding start and end date for lastmonth

2002-03-20 Thread Craig Sharp
Thats exactly what I was looking for. I forgot about sprintf. Thanks! Craig >>> "Adam Frielink" <[EMAIL PROTECTED]> 03/20/02 02:11PM >>> > -----Original Message- > From: Craig Sharp [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, March 20, 20

RE: [Perl-unix-users] Finding start and end date for lastmonth

2002-03-20 Thread Craig Sharp
te::Calc has a Day_In_Month method which only requires the year and month for paramters. Adam > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of > Craig Sharp > Sent: Wednesday, March 20, 2002 10:54 AM > To: [EMAIL PROTECTED] > Su

[Perl-unix-users] Finding start and end date for last month

2002-03-20 Thread Craig Sharp
I need to be able to find the start and end dates for last month on the first of each month. Once found, I need to store them in variables in the format 2002-02-01, etc. Does anyone have a script to do this or can you point me in the right direction? Thanks, Craig A. Sharp Unix Systems Admini

Re: [Perl-unix-users] Sourcing variable in perl?

2002-03-18 Thread Craig Sharp
Great thanks for your help :-) Craig >>> "Jenda Krynicky" <[EMAIL PROTECTED]> 03/18/02 10:21AM >>> From: "Craig Sharp" <[EMAIL PROTECTED]> > Jenda and Bill, > > Ok, I went out and generated a list of the environment

Re: [Perl-unix-users] Sourcing variable in perl?

2002-03-18 Thread Craig Sharp
have set them in the require file? Thanks, Craig A. Sharp Unix Systems Administrator DNS Administrator Roush Industries Office: 734-466-6286 Cell: 734-231-6769 Fax: 734-466-6939 [EMAIL PROTECTED] ==== I have not lost my mind, it's backed up on tape somewhere!

[Perl-unix-users] Sourcing variable in perl?

2002-03-17 Thread Craig Sharp
Hi all, In a shell programming, I can run a script with a period-space in front of the script: Eg: . script_name.scr This will cause the variables to be sourced to the parent process. In other words, any variables that are created within the child process running the script become available

[Perl-unix-users] Automatic ftp download script

2002-03-11 Thread Craig Sharp
Ok, here is a good one. I need to be able to monitor a directory on an ftp server and then download the files when they have been uploaded to the server. The problem is how to determine when a file is there and if a file is there, that the file is done being uploaded from the source. I was go

Re: [Perl-unix-users] strict help needed !!!!

2002-03-05 Thread Craig Sharp
Fixed. The replies to my request indicated that I was using a hash { } instead of an array [ ] like I needed. What a dumb mistake! Thanks for all your help! Craig >>> "Craig Sharp" <[EMAIL PROTECTED]> 03/05/02 11:32AM >>> I am having a problem with the fol

[Perl-unix-users] strict help needed !!!!

2002-03-05 Thread Craig Sharp
I am having a problem with the following script: #!/usr/bin/perl -w use strict; use Spreadsheet::WriteExcel; my $workbook = Spreadsheet::WriteExcel->new("unixsvrs.xls"); my $worksheet = $workbook->addworksheet(); my @date; my @time; my @device; my @address; my @count; my $index; my $data; my

Re: [Perl-unix-users] Parsing a file help please

2002-03-05 Thread Craig Sharp
Dave and Phil, Both of your solutions worked just great. Thanks for your assitance. Craig >>> Philip Andrew <[EMAIL PROTECTED]> 03/04/02 04:23PM >>> Craig Sharp wrote: >I am trying to parse a file with the following script: > >. . . . > >1. Loo

[Perl-unix-users] Parsing a file help please

2002-03-04 Thread Craig Sharp
Hi all, I am trying to parse a file with the following script: #!/usr/bin/perl use strict; open

Re: [Perl-unix-users] URGENT - file types and sizes total in adir tree

2002-01-25 Thread Craig Sharp
ON'; $exts{$ext} += -s; } select DIROUT; for (sort keys %exts) { print "$_=>$exts{$_} bytes\n"; } Enjoy! Thanks for the help! Craig >>> Jim Angstadt <[EMAIL PROTECTED]> 01/21/02 04:20PM >>> --- Craig Sharp <[E

Re: [Perl-unix-users] URGENT - file types and sizes total in adir tree

2002-01-21 Thread Craig Sharp
;> Jim Angstadt <[EMAIL PROTECTED]> 01/18/02 03:00PM >>> --- Craig Sharp <[EMAIL PROTECTED]> wrote: > Jim, > > Thanks for the reply. Interesting code. This sure > is a learning experience :-) > > I tried to run the code on win2k and received the >

[Perl-unix-users] URGENT - file types and sizes total in a dir tree

2002-01-17 Thread Craig Sharp
This question will be used for win32 file tree but will also apply to unix so I am posting here. We have had a request to generate a report for total space usage by file type (extension) within a directory tree. Eg: Start at the top of the tree, look at all the file types by extension and

RE: [Perl-unix-users] Setting variables with a module

2002-01-16 Thread Craig Sharp
Correct, the variables are special variables for Informix and Peoplsoft. >>> Peter Eisengrein <[EMAIL PROTECTED]> 01/16/02 03:45PM >>> you mean vars other than what is in %ENV ? > -Original Message- > From: Craig Sharp [mailto:[EMAIL PROTECTED]]

[Perl-unix-users] Setting variables with a module

2002-01-16 Thread Craig Sharp
Hello, I would like to be able to set variables by using a module. The module would be simple but provide a list of variables such as: $PSOFTDIR=/psoft/bin; An example for the calling program would be: #!/usr/bin/perl use module_name; print $PSOFTDIR; Is there an easy way t

[Perl-unix-users] Regex problem

2002-01-07 Thread Craig Sharp
Hi all, I have a file with lines that are in the following format: 20011219 074645 b03 3524 switch 10.3.xxx.xxx 3 I need to do a substitution so that the line appears as: 20011219 074645 b03-3524-switch 10.3.xxx.xxx 3 Note the inclusion of the dashes. Here is another

[Perl-unix-users] CPAN on Novell Ent Web Server

2001-12-12 Thread Craig Sharp
Hi all, Does anyone have experience with installing CPAN modules on a Novell Enterprise Web Server? Thanks, Craig A. Sharp Unix Systems Administrator DNS Administrator Roush Industries Office: 734-779-7282 Cell: 734-231-6769 Fax: 734-779-7807 [EMAIL PROTECTED] =

[Perl-unix-users] Installing modules on Netware Enterprise Web Server?

2001-12-07 Thread Craig Sharp
I need to be able to install CPAN modules on a Netware Enterprise Web Server. I have checked the Novell website and they say that you can install the modules but do not give instructions. Can anyone help me with this problem? Thanks, Craig A. Sharp Unix Systems Administrator

[Perl-unix-users] Re: DBD::Informix problem

2001-12-05 Thread Craig Sharp
Jonathan, I like the second option but I am a bit unsure on opening the second connection part. Can you expound on that area? Thanks, Craig >>> Jonathan Leffler <[EMAIL PROTECTED]> 12/05/01 01:18AM >>> Craig Sharp wrote: >I am trying to u

Fwd: RE: [Perl-unix-users] DBD::Informix problem [[[[[ OT]]]]]]]

2001-12-04 Thread Craig Sharp
27;t see why XML::Parser failed to put the files in the right place to start with even though the make test worked? had anyone come across this problem or know a good place to start looking for some help ? TIA Geoff If you need any info about the configuration of the AIX box, please ask me...

[Perl-unix-users] DBD::Informix problem

2001-12-03 Thread Craig Sharp
I am trying to use DBD::Informix to query a remote database. I am connected to a local database and then issuing a remote sql query: select * from perf_info@roushprod:archive_info roushprod is in the sqlhosts file. The statement works correctly outside of the DBD/DBI functions.

[Perl-unix-users] DBD::Informix problem

2001-11-30 Thread Craig Sharp
I am trying to use DBD::Informix to query a remote database. I am connected to a local database and then issuing a remote sql query: select * from perf_info@roushprod:archive_info roushprod is in the sqlhosts file. The statement works correctly outside of the DBD/DBI functions.

[Perl-unix-users] Substitution help needed

2001-11-30 Thread Craig Sharp
Hi all, I have several lines like the following in a file. I need to make a substitution for the line. I am reading the file into @lines. I then loop through looking for the line. When I find the line, I need to make the change. Then I will write it out to a new file. Here is

[Perl-unix-users] perl and html table? Working now!

2001-11-30 Thread Craig Sharp
Thanks to all. All ideas are great and I was able to make the tables work as I need. Craig ___ Perl-Unix-Users mailing list. To unsubscribe go to http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users

[Perl-unix-users] perl and html tables?

2001-11-30 Thread Craig Sharp
I need to create a script that will use DBI to retreive information from Informix and then present the information in a table in html. The DBI part I have with no problem. I need to use perl to create a table in html that will expand or reduce as needed depending on how many rows are

RE: [Perl-unix-users] Script Help Please

2001-11-26 Thread Craig Sharp
edictable. e.g. It alway falls after UP. If you cannot predict where the server name falls then it will be more efficient to put the text that occurs least frequently on the left of the && as the right-hand side is only evaluated if the left-hand expression returns true. Stev

[Perl-unix-users] Script Help Please

2001-11-26 Thread Craig Sharp
Hi all, I am lost. I have the following script that opens the log file WUGEvent.log and looks for the statment "UP", replaces spaces and writes out the new log file. It works great! Here is the problem. I need to read in another file (wuglist.txt) containing a list of server names

[Perl-unix-users] A little off sub - listing NT processes

2001-11-13 Thread Craig Sharp
Hi all, I know this is a bit off subject but the question might help everyone. I need to be able to list the running processes in NT or 2K (server and workstation). Is there a simple way to script this in perl? Thanks, Craig A. Sharp Unix Systems Administrator DNS Adminis

[Perl-unix-users] Update: need qw help

2001-10-25 Thread Craig Sharp
I tried running the script in Linux on perl v5.6.0. Runs fine. The script will actually be run on hpux with perl v5.6.0. There the script will not run. I get the syntax error. How about that for a wrench in the works? Craig ___ Pe

[Perl-unix-users] need qw help

2001-10-25 Thread Craig Sharp
Hi all, I have the following short script that does not work: #!/usr/bin/perl @pvlist = qw{ /dev/dsk/c0t9d0 /dev/dsk/c0t10d0 /dev/dsk/c0t11d0 }; foreach (@pvlist) { print "$_\n"; } I am getting the following error: syntax error in file pvcfg at line

[Perl-unix-users] perl and ncurses

2001-10-23 Thread Craig Sharp
Hi all, Does anyone know where I can find info on Ncurses modules and how to program perl for ncurses. Thanks, Craig A. Sharp Unix Systems Administrator DNS Administrator Roush Industries Office: 734-779-7282 Cell: 734-231-6769 Fax: 734-779-7807 [EMAIL PROTECTED] ==

RE: [Perl-unix-users] Setting env vars in hp-ux

2001-10-18 Thread Craig Sharp
x27;t got much to do with HP-UX. Any processes initiated by the script will have it set in their environment. hth, Craig Arnold Boeing Space and Communications International Space Station Guidance, Navigation and Control Huntington Beach, CA (714)896-3311 x68266 > --

[Perl-unix-users] Setting env vars in hp-ux

2001-10-17 Thread Craig Sharp
Hi all, I wrote a script in perl for hp-ux. The script was designed to check for a process and compare the cpu to a threshold and then alarm if the threshold is exceeded. Here is the problem. I need to set a hp-ux environment variable everytime the script is run. The script will run

[Perl-unix-users] Working with Novonyx

2001-01-18 Thread Craig Sharp
Hello, I have several scripts that work fine in Linux (RH7) with apache. I am trying to move the scripts to a Novonyx / Suitespot (Novell) web server and the scripts will not run. I would appreciate any help in getting the scripts to work. Thanks, Craig A. Sharp Unix System Administra

[Perl-unix-users] String problem from post method

2001-01-08 Thread Craig Sharp
Hello, I am using a form on my website for procedure submission. The form has several input boxes for the user to enter information. The actual procedure input box may have several lines that contain carriage returns. As an example, a numbered list of steps to follow. I am using the po