Some Date Arithmetic/Manipulation help please !!!

2010-01-22 Thread newbie01
Hi all, Need some advise please on how do date arithmetic/calculation. Basically, I have a CSV delimited file that I need to do some date calculations on. Am parsing the fields as $date1 and $date2 and I need to do the time difference as $date2-$date1 Example of $date1 and $date2 below: $date1

Changing @INC - related to my Date post ... :-) - something trivial I think

2010-01-22 Thread newbie01
Hi all. Am wanting to change the location of @INC to point to where some of the date's pm files are. Can anyone please advise if it is possible to have the use lib on a single line or is this not possible? #!/usr/bin/perl use lib '/oracle/product/10.2.0/perl/lib/site_perl/5.8.3/HTTP'; use Date;

Some Date Arithmetic/Manipulation help please !!!

2010-01-22 Thread newbie01 perl
Hi all, Need some advise please on how do date arithmetic/calculation. Basically, I have a CSV delimited file that I need to do some date calculations on. Am parsing the fields as $date1 and $date2 and I need to do the time difference as $date2-$date1 Example of $date1 and $date2 below: $date1

Perl DBI Oracle SYSDBA help/advise please:

2010-02-10 Thread newbie01 perl
Hi all, To anyone who had been using Perl DBI and Oracle, can you please confirm if connection by SYSDBA works or doesn't? I currently have the following DBI / DBD installed on this problem: DBI Version : 1.43 DBD Version : 1.15 Unfortunately, am not the SA so can't just install the latest modu

Perl Hiding Username/Password

2010-02-10 Thread newbie01 perl
Hi all, Can anyone please advise how I can change the following codes to work where the and are not exposed? Script is ran via crontab and can also be run manually, at the moment am reading these values from some sort of delimited file. The worry is someone getting access to the script and then

Perl error trapping help, for example DBI

2010-02-10 Thread newbie01 perl
Hi all, Just want to know if there is an alternative to these error "trapping" that am using for the following code: #!/usr/bin/perl use DBI; $dbh = DBI->connect('dbi:Oracle:host=localhost;sid=test1;port=1521', 'test1_user', 'test1_password'); if ( defined($dbh) ) {# Checking for a succ

Perl equivalent to UNIX's <

2010-02-10 Thread newbie01 perl
Hi all, We are in the process of changing UNIX and MS-DOS scripts into Perl, mostly UNIX scripts and there are a lot of codes that uses the < Today is ==> ' || sysdate from dual ; set heading on prompt prompt - MAX DATETIME prompt select max(datetime), max(ackdatetime), max(tim

Re: Perl equivalent to UNIX's <

2010-02-10 Thread newbie01 perl
u, Feb 11, 2010 at 2:11 PM, Jim Gibson wrote: > On 2/10/10 Wed Feb 10, 2010 3:07 PM, "newbie01 perl" > scribbled: > > > Hi all, > > > > We are in the process of changing UNIX and MS-DOS scripts into Perl, > mostly > > UNIX scripts and there are a l

Perl CGI advise/feedback please ...

2010-02-10 Thread newbie01 perl
Hi all, I am wanting some advise/input on setting up some sort of intranet site to allow system operators to manage the servers, mostly UNIX servers and some Windows. I am constrained by not being able to install new modules or a database, for example, MySQL. The web server will be Apache. Given t

Re: Perl Hiding Username/Password

2010-02-11 Thread newbie01 perl
the owner of the script ... On Thu, Feb 11, 2010 at 10:37 PM, Philip Potter wrote: > On 10 February 2010 23:04, newbie01 perl wrote: > > > > Hi all, > > > > Can anyone please advise how I can change the following codes to work > where > > the and are not expos

Windows Services and Logical Volume Monitoring Script ....

2010-03-09 Thread newbie01 perl
Hi all, Am trying to write a script that will simply list all Windows Services and its Status, i.e Started or Not Started and the percent used and percent available space of logical volumes on Windows, is there anyone on this group that may already have a script similar to this that he/she is will

CGI-BIN Help/Advise - editing a file - HOW ?

2010-03-15 Thread newbie01 perl
Hi, At the moment, I have some sort of INI/config file that I edit manually via vi. These config files are "simple" delimited file that are used by some of the scripts running on the server. I want to be able to the same thing via cgi-bin, can anyone advise where to start. Basically, I want to be

Any Oracle DBA Around ???? - Perl DBI of Oracle Enterprise Manager (OEM) Install

2010-04-06 Thread newbie01 perl
Hi all, We currently have OEM installed but will have to uninstall it due to Oracle Licensing issues. Customers do not want to pay for the performance and diagnostic pack and are actually considering to move to SQLServer .. :-) Anyway, am wanting to try out and install oracletool or orcaware. Bot

Converting 12 hour time format to 24 hour format ... a bit urgent

2010-04-07 Thread newbie01 perl
Hi all, I have a Perl script that uses Date::Calc to calculate difference between two datetime variables using Decode_Month and Delta_YMDHMS. ( $yy, $mm, $dd, $hh, $mi, $ss ) = Delta_YMDHMS( $logical_yy, $logical_mm, $logical_dd, $logical_hh, $

Re: Any Oracle DBA Around ???? - Perl DBI of Oracle Enterprise Manager (OEM) Install

2010-04-07 Thread newbie01 perl
age, it is very generic, that it cannot find the DBI module. The script is very simple as below: #!/ use DBI; On Wed, Apr 7, 2010 at 12:16 AM, Rob Coops wrote: > > > On Tue, Apr 6, 2010 at 2:06 PM, Shlomi Fish wrote: > >> Hi Chen, >> >> "newbie01 perl"

Re: Any Oracle DBA Around ???? - Perl DBI of Oracle Enterprise Manager (OEM) Install

2010-04-07 Thread newbie01 perl
15:17:15 newbie01 perl wrote: > > Hi Rob and all, > > > > Thanks for all your response. They are all very helpful. Unfortunately, > am > > not in the office at the moment. > > > > I agree with your suggestion about hacking one of the OEM Perl script but > &

Date calculation help/suggestion please ... when there is no Date or Time module available

2010-04-07 Thread newbie01 perl
Hi all, I have a Perl script on Windows that does date calculation and using Date::Calc, Decode_Month and Delta_YMDHMS functions Am using the script to calculate the difference between two dates, for example, for the two (2) dates below: 01/Jan/2010 04:01:27 01/Jan/2010 02:06:30 The script is wo

How to check modules ... ???

2010-04-07 Thread newbie01 perl
Hi all, Running perl -V gives output below which is the path to the modules that the default perl have access to. Is there any way to display the installed modules that are available to use so that at least it will not be too late to find out? The main objective is being able to know what modules

Help on using << on *nix and Windows

2010-04-19 Thread newbie01 perl
Hi all, I need to convert a lot of UNIX scripts into Perl. Most of them uses the UNIX's EOF/EOL functionality. These scripts are mostly used to connect to Oracle databases. At the moment, installing a DBI is not an option. The scripts will be running locally on the servers so technically it should

Writing Perl scripts to run on any OS'es

2010-04-19 Thread newbie01 perl
Hi all, Am wanting to change my Perl scripts to get it to run on several UNIX flavours and Windows. At the moment, the only way I can think of how to accomplish that is always having the following checks on each and every sub that I have. Can anyone please suggest if there is a better way of doin

Perl script to change XML to text ... ???

2010-04-20 Thread newbie01 perl
HI all, Does anyone know of any XML to text Perl script around that I can use? Basically, I have an XML file that is supposed to composed of fields and unfortunately on the server, I do not have a browser to view it properly, at the moment, am downloading the file and then viewing it from my brow

Local and global at the same time?

2010-04-20 Thread newbie01 perl
Hi all, If I declare a variable x1 outside of the sub that makes it global, right? Now the question is can I have the same variable x1 as a local variable of a sub, i.e. will the following work? $x1 = "cat"; sub sample() { my $x1="dog"; ... ... } Just trying to work out some guidelines

Re: Help on using << on *nix and Windows

2010-04-21 Thread newbie01 perl
Thanks to everyone who had responded to this post ... On Tue, Apr 20, 2010 at 1:56 AM, David Nicol wrote: > Someone calling themselves newbie01.perl is really kind of dubious, > couldn't you have made up a more fun nomme de guerre, like "Olyve > Crudite"? I'm going

UNIX permission bit calculator ... ???

2010-04-21 Thread newbie01 perl
Hi, Does anyone have a UNIX permission bit calculator script that I can use? Basically, am looking for one where I don't have to a ls -l to check the permission on a file or directory. Am looking for a script that will display the permission bits and then just display what those permission bit set

Source for Perl maintenance scripts anywhere ...

2010-05-19 Thread newbie01 perl
Hi all, Instead of re-inventing the wheel, I would like to possibly use existing Perl scripts that may already be available out there. Scripts that am looking for are mainly maintenance scripts, i.e. remove old files, rotate log files, remove old directory ( mainly core dumps directory ), believe

Output to screen and to file ... how ... ???

2010-05-26 Thread newbie01 perl
Hi all, Can someone please help and advise if it is possible to have the output of the code below to the screen and at the same time to the file as well? open(ORA, "| dgmgrl > dgmgrl.out" ) or die "Can't pipe to dgmgrl: $!"; print ORA "connect sys/passw...@${connect_string_02}\n "; print ORA "sho

Re: Output to screen and to file ... how ... ???

2010-05-26 Thread newbie01 perl
grl | tee dgmgrl.out" ) ? > > this begs the whole question of why the OP isn't using DBI. > > yy> 2010/5/27 newbie01 perl : > >> Hi all, > >> > >> Can someone please help and advise if it is possible to have the output > of > >> the

Which module ... ???

2010-05-26 Thread newbie01 perl
Hi all, With multiple Perl install, there will be multiple versions of the same modules. How can you change the order of where @INC look for the specific version of the module that you want to use? Is this done by using use lib? use lib qw(/path/to/one/library /path/to/another .. );

Setting PERL5LIB ... is this the expected behaviour ... ???

2010-05-27 Thread newbie01 perl
Hi all, Just need to confirm if this is the expected behaviour when setting PERL5LIB. If I have the folllowing in my script ... == #!/usr/bin/perl $ENV{PERL5LIB}="/oracle/product/db/11.1/perl/lib/site_perl/5.8.3/x86_64-linux-thread-multi"

How to set LD_LIBRARY_PATH

2010-05-28 Thread newbie01 perl
Hi all, Can someone advise how to set LD_LIBRARY_PATH from within the Perl scripts? If I set LD_LIBRARY_PATH from the command line, all is okay [oracle ~]$ perl -e 'use DBD::Oracle; print $DBD::Oracle::VERSION,"\n";' Can't load '/oracle/product/db/11.1/perl/lib/site_perl/5.8.3/x86_64-linux-threa

Some DBI question -

2010-05-29 Thread newbie01 perl
Hi, Am trying out DBI for Oracle and just want to know if for example, I need to include column formatting stuff etc., is it best to just put them into a .sql file and then execute the .sql file instead of placing them in the Perl DBI script? Also, is there anyway to sort of "hide" the password s

List of Available Modules ... ???

2010-06-04 Thread newbie01 perl
Hi all, I know perl -V prints what are the current modules directories that are accessible ... but is there a way to list all the available modules from each directories as well?

Where - best source for Perl scripts example ... mostly SYSADMIN stuff

2010-06-04 Thread newbie01 perl
Hi all, Sorry for being lazy I guess but am assuming a lot of you will probably have a list of their favorite sites for resources of Perl scripts I did find a lot as well via Google but mostly Perl CGI stuff though ... Basically, am wanting to know where is the "best" place to find scripts

Just asking - Tips on how to maintain your scripts ..

2010-06-04 Thread newbie01 perl
Hi all, Just writing to ask if any one can advise on what tools to use best for maintaining your scripts ... preferably free/open source and portable if there is one, that is, one that can be placed and run on a USB stick ... At the moment, am having them in directories and files and no versionin

Remove old core dump directories in Oracle ... ???

2010-06-06 Thread newbie01 perl
Hi all, Oracle core dumps are created as directories. I want to remove these directories after a certain period of time, for example 10 days. I have the following script that searches a directory for files that are older than 10 days and possibly remove them. At the moment, for the sake of testin

Re: Remove old core dump directories in Oracle ... ???

2010-06-06 Thread newbie01 perl
2010/6/7 Shlomi Fish > On Sunday 06 Jun 2010 19:59:36 Wojciech Łysiak wrote: > > On 06.06.2010 18:12, newbie01 perl wrote: > > > Hi all, > > > > > > Oracle core dumps are created as directories. I want to remove these > > > directories after

Re: Remove old core dump directories in Oracle ... ???

2010-06-06 Thread newbie01 perl
On Mon, Jun 7, 2010 at 3:25 PM, Uri Guttman wrote: > >>>>> "np" == newbie01 perl writes: > > np> I found a better example at a Perlmonk posting and changed it a bit as > np> below: > > np> #!/usr/bin/perl > np> use strict; > &g

Re: Remove old core dump directories in Oracle ... ???

2010-06-06 Thread newbie01 perl
loop ... The script is to search the core dump directory but exclude that directory, kinda like doing a grep for ^/u01/oradump/cdump, /u01/oradump/cdump$/ and exclude that from the directory to remove. On Mon, Jun 7, 2010 at 4:32 PM, Uri Guttman wrote: > >>>>> "np" =

Re: Remove old core dump directories in Oracle ... ???

2010-06-06 Thread newbie01 perl
g the @ARGV ... Your hacked pseudo-code works fine and does what am looking for ... Thanks ... On Mon, Jun 7, 2010 at 6:45 PM, Uri Guttman wrote: > >>>>> "np" == newbie01 perl writes: > > np> Hi Uri, > uri> first off please edit the quote

Re: Remove old core dump directories in Oracle ... ???

2010-06-07 Thread newbie01 perl
Hi Uri, Oops ... sorry, I think I've explained it wrong ... I mean, supposedly, the script is to scan the sub-directories of $ARGV[0] but not include $ARGV[0] in the list so I've modified the pseudo-code hack that you provided to do just that ...

Perl stat script ... ???

2010-07-18 Thread newbie01 perl
Hi all, Does anyone know if someone had written a Perl stat script that mimics the Linux' stat command? I want to be able to use the stat command on Solaris, unfortunately, I just found out that that command is not available on Solaris and HP-UX so am thinking a Perl script should be the way to g

Some explanation please -- iterating thru command line arguments

2010-07-21 Thread newbie01 perl
Hi all especially Perl teachers if anyone is ... :-) I just want to know if someone can provide some explanation on how does the argument iterator sub-routine below work. The Perl script is called from a UNIX Korn script as below: mail_smtp.pl -r ${MAILFROM} -s "$subject_line TEST EMAIL" supportm

Re: Some explanation please -- iterating thru command line arguments

2010-07-23 Thread newbie01 perl
Hi Brandon, Thanks ... using the cat and pipe looks "cleaner" ... I will try that one ... thanks On Fri, Jul 23, 2010 at 4:53 AM, Brandon McCaig wrote: > On Wed, Jul 21, 2010 at 1:17 PM, newbie01 perl > wrote: > > Does $_ contains the following values on each iteration

Using open and pipe and regex - need some guidance please

2010-09-05 Thread newbie01 perl
Hi, Do the following set of codes does the same thing? FYI, am more interested on whether I can use CODE 03 to pipe/re-direct output from the OS commands, i.e. ps, df etc. Will using | works on Windows as well? Am very new to Perl and has mostly done UNIX shell scripting. Am wanting to write Per

Scan/Parse directory for "newest" file, print file timestamp and compute date/time difference - Some advice please

2011-03-02 Thread newbie01 perl
Hi all, Am wanting to get some advise on how to write this Perl script. I have a backup directory that I have to check for the existence of file/s and if the latest file that exist there is 2 days old, that means I have a problem and had to send an email notification. To illustrate if, for examp

Date arithmetic advise/improvement - using stat ... calling the Perl script from a UNIX script

2011-03-10 Thread newbie01 perl
Hi all, Just want to know what improvement can be done with the code below if any. I am sure a lot of improvement/changes is required. I will be calling this script from a UNIX script, i.e.timediff=`timediff.pl $file`, so $file will be passed to the Perl script. It's probably a good idea to check

Permission bit translator?

2011-03-10 Thread newbie01 perl
Hi, Does anyone know of any permission bit "translator"? One that can translate the permission bit from its textual value to its octal value and vice versa. It is alright if it is always just rwx but on a lot of occasions nowadays, getting a lots of s, S, t, etc. -rwxrwxrwx 1 oracle dba

Checking a config file for malformed entries - Oracle TNSNAMES.ORA file - having problems, please help

2011-07-21 Thread newbie01 perl
Hi all, In Oracle, there is a file named tnsnames.ora that contains connection strings to Oracle Databases. At the moment the file is 1+ lines long. We are currently having a problem where the file is malformed, i.e. missing matching brackets. Can any of the experts please advise how best to

Any suggestion on how to "improve" this code? Malformed braces

2011-07-27 Thread newbie01 perl
Hi all, I've written a Perl script below that check and report for malformed braces. I have a UNIX ksh version and it took a couple of minutes to run on a 1+ lines. With the Perl version it only took about 20 seconds so I decided to do it the Perl way. Besides I need a similar thing for Window

bracket checker - http://pastebin.com/d8GNL0kx - Any clue on the error?

2011-07-28 Thread newbie01 perl
Hi, Am just trying out this bracket checker script but when I ran it, it is giving errors below. Just curious to know what the error is about? Please advise. Thanks Error below: http://pastebin.com/d8GNL0kx ./123.pl testfile01x.ora Malformed UTF-8 character (unexpected continuation byte 0xbb)

Re: Any suggestion on how to "improve" this code? Malformed braces

2011-07-31 Thread newbie01 perl
Hi John, For checking a 10,+ lines, your code cut down the processing time from 30 seconds to a mere 5 seconds, amazing. Thanks a lot. On Thu, Jul 28, 2011 at 10:04 PM, John W. Krahn wrote: > newbie01 perl wrote: > >> Hi all, >> > > Hello, > > > I&#x

Output formatting help

2011-08-01 Thread newbie01 perl
Hi all, I have several *nix version of Unix and while some I can use df -h, for some I can't. The only common thing that I can use that works for all is df -k. Below is the output when running df -k: Filesystem

Help with Getopt::Std

2011-10-20 Thread newbie01 perl
Hi all, Playing around with Getopt::Std as am trying to convert a UNIX Korn Shell Script to a Perl script. Is it possible to check for what are the values for opterr, optarg, optind? How? :(- I've been Googling for quite sometime now and can't find an example of Perl scripts that checks for opte

Re: Help with Getopt::Std

2011-10-21 Thread newbie01 perl
011 at 5:07 PM, Brandon McCaig wrote: > On Thu, Oct 20, 2011 at 11:45 PM, newbie01 perl > wrote: > > Playing around with Getopt::Std as am trying to convert a UNIX > > Korn Shell Script to a Perl script. > > > > Is it possible to check for what are the values for opt

HELP on Perl array / sorting - trying to convert Korn Shell Script to Perl

2011-10-21 Thread newbie01 perl
Hi all, Am trying to write/convert a customized df script in Perl and need some help with regards to using arrays and file handlers. At the moment am using system("df -k > /tmp/df_tmp.00"); To re-direct the df output. Am using df -k because some of the Solaris and HP servers does not have df -h

Re: HELP on Perl array / sorting - trying to convert Korn Shell Script to Perl

2011-10-30 Thread newbie01 perl
Hi Rob, Thanks for your response and to everyone else who had given their thoughts, especially John. This whole exercise is turning out to be a "fun" way of learning arrays and print formatting. I tried the script that you suggested and it is giving some error and not sure how to get around it. F

Script to test connecting to Oracle DBs

2012-07-27 Thread newbie01 perl
Hi all, I am looking for a Perl script or something similar that I can use to test connection from a client PC to several databases on a server. Does anyone know of any such script lying around somewhere :(- Currently, am testing connection from a client PC to an Oracle DB using Oracle's sqlplus

File/string formatter script?

2012-09-14 Thread newbie01 perl
Hi all, I have a config file that contains some text as below: server01:/u01/app/oracle/admin/db01/adump :*.dmp,5 :compress :/bin/gzip server01:/u01/app/oracle/admin/db04/adump :*.aud,5 :remove :/bin/rm server01:/u01/app/oracl

Re: File/string formatter script?

2012-09-16 Thread newbie01 perl
sample code below is a big help. Thanks again. On Sun, Sep 16, 2012 at 12:28 AM, Rob Dixon wrote: > On 15/09/2012 02:52, newbie01 perl wrote: > > Hi all, > > > > I have a config file that contains some text as below: > > > > server01:/u01/app/oracle/admin

Tutorial for a menu driven perl script

2012-12-20 Thread newbie01 perl
Hi, Does anyone know of any great source/link for tutorials on menu driven Perl? Thanks in advance.