Matching Over Multiple Lines

2009-03-17 Thread Jeff Westman
All, I know this has been asked many times, and I have read the documentation ("perldoc -q "matching over more than one line") and still can't make head or tails out of this. I have a problem where my pattern can be in one line, or span multiple lines. This is what I have so far (simplified):

Binary File Editing - Help!

2008-10-03 Thread Jeff Westman
Hello All, I am having a problem that should be very simple. I cannot figure this out for the life of me. I have a business need where I need to change a literal in a zip file from one string to another. Specifically, I need to change a filename embedded in the zip file (the one that would be e

Decrementing Characters

2008-08-25 Thread Jeff Westman
Hi, Simple question here. I need to decrement a character "counter". Incementing works fine, but not decrementing. I have: #!/bin/perl use warnings; $var = 'm'; print "var was $var\n"; $var++; print "var was $var\n"; --$var; print "var is $var\n"; And I get: 0: rc-hp18:/home/dnxjjw5/dev $

Re: Parse Help

2006-09-12 Thread Jeff Westman
Too easy! THANKS JOHN!!! On 9/12/06, John W. Krahn <[EMAIL PROTECTED]> wrote: Jeff Westman wrote: > Hello, Hello, > I have a string that I would like to parse and change the format. I'm not > that good at 'map' and I'm just looking for a quick-and-dir

Parse Help

2006-09-12 Thread Jeff Westman
Hello, I have a string that I would like to parse and change the format. I'm not that good at 'map' and I'm just looking for a quick-and-dirty way of doing this. I've tried substr and split, but there has to be a simple way to do this. My text string looks like [20060911 14:47:11]p_var1= KQt=

Re: Regex Multi-Line Matching

2005-06-22 Thread Jeff Westman
Hey Chris, I'm not spamming anyone. I had an error when I sent my email(s) so I resent it. Sorry you had to click the mouse an additional time to 'delete'. Jeff On 6/20/05, Chris Devers <[EMAIL PROTECTED]> wrote: > On Mon, 20 Jun 2005, Jeff Westman wrote:

Regex Multi-Line Matching

2005-06-20 Thread Jeff Westman
My problem is simple. I want to parse an Oracle TNS file, listing host and the service it provides. A sample TNS entry is multi-lined and looks like this: mysprdtmp = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = mxr)(PORT = 1521)) ) (CONNECT_DATA =

RegEx Multi-Line Matching

2005-06-20 Thread Jeff Westman
Hello Fellow Perlites, I'm having difficulty parsing a file and could use some help here. I've attached my code, output file, and sample job run. Basically, I want to read an Oracle TNS file (tnsnames.ora) and list the host name and service on that server based on this input file. A sample TNS e

Regex Multi-Line Match

2005-06-20 Thread Jeff Westman
Hello Fellow Perlites, I'm having difficulty parsing a file and could use some help here. I've attached my code, output file, and sample job run. Basically, I want to read an Oracle TNS file (tnsnames.ora) and list the host name and service on that server based on this input file. A sample TNS

Using ftp/netrc on AIX

2005-01-20 Thread Jeff Westman
Hi All, I have an ftp script that connects and does the usual things (change dir., site change mode, transfer file, etc). I am using Net::FTP. Currently, I pass the server name, user id and password from the environment. Is $HOME/.netrc compatible with this module, does anyone know?? When I tr

Change ctime of a file ?

2004-12-03 Thread Jeff Westman
Is it possible to change the 'create timestamp' (ctime) of a file, and if so, how? This would be the perl equivalent of Unix' "touch" command. Thanks in advance! -Jeff -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Passing shell variables to PERL

2004-10-08 Thread Jeff Westman
On Wed, 06 Oct 2004 16:21:31 -0700, John W. Krahn <[EMAIL PROTECTED]> wrote: > [Please do not top-post. TIA] ok > Jeff Westman wrote: > > > > On Tue, 05 Oct 2004 15:30:59 -0700, John W. Krahn wrote: > > > >>Jim wrote: > >> > >>>Will

Re: Passing shell variables to PERL

2004-10-06 Thread Jeff Westman
You have to export the variable if you want perl to recognize it! Example: $ ABC=xyz $ perl -e 'print "$ENV{ABC}\n"' $ export ABC=xyz $ perl -e 'print "$ENV{ABC}\n"' xyz $ -Jeff On Tue, 05 Oct 2004 15:30:59 -0700, John W. Krahn <[EMAIL PROTECTED]> wro

How to Sort on a substr

2004-07-15 Thread Jeff Westman
Hi, I need to do a sort on a couple of column ranges. I want to be able to do a primary sort, on say, columns 21-25 and then a secondary sort on columns 40-49. Any ideas on how to approach this? TIA /j __ Do you Yahoo!? Yahoo! Mail - You ca

RE: SQL PLUS

2004-06-11 Thread Jeff Westman
Bob Showalter <[EMAIL PROTECTED]> wrote: > jason corbett wrote: > > What would I need to call SQL Plus into action for PERL? > > If you just need to execute SQL statements, use the DBI module > and talk directly to the database. > > If you need to run existing sqlplus reports, use any of the > s

Sort on Pipe-Delimited Column

2004-05-29 Thread Jeff Westman
Hello, I have some data that is pipe-delimited, that I would like to sort on the first column (numeric). The data looks like this: 173|Supertramp|The Very Best of Supertramp 19|Story, Liz|My Foolish Heart 54|Tchaikovsky|Nutcracker Suite 187|Tesla|Time's Makin' Changes: The Best of Tesla and onc

Re: excel

2004-05-21 Thread Jeff Westman
I just did this in fact using CSV.pm, worked great! See: http://search.cpan.org/~alancitt/Text-CSV-0.01/CSV.pm --- "DiGregorio, Dave" <[EMAIL PROTECTED]> wrote: > Does anyone know, what is the best way to retrieve text data from > an Excel > Spreadsheet? I have tried the code below and it re

RE: Installation Problem -- Text::CSV

2004-05-19 Thread Jeff Westman
Bob Showalter <[EMAIL PROTECTED]> wrote: > Jeff Westman wrote: > > Hi All, > > > > I am running Active Perl 5.8.0, and installed CSV.pm into > > c:\perl\lib\text. When I run the test.pl file with it I get > > > > C:\> perl test.pl > > 1..

Installation Problem -- Text::CSV

2004-05-19 Thread Jeff Westman
Hi All, I am running Active Perl 5.8.0, and installed CSV.pm into c:\perl\lib\text. When I run the test.pl file with it I get C:\> perl test.pl 1..20 Can't locate auto/Text/CSV/autosplit.ix in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib .) at C:/Perl/lib/AutoLoader.pm line 158. at C:/Perl

DBI/DBD/Oracle Installation

2004-05-05 Thread Jeff Westman
Hi All , To install the DBI and DBD drivers for Oracle, I would want to install these in my $HOME directory. Does anyone know if these require a C/C++ compiler to install once I download from CPAN? The compiler here is HPUX and not gcc compliant. I'm just asking ahead of time hoping some

Re: starting perl

2004-05-02 Thread Jeff Westman
You need to add perl to your %PATH% or give it an explicite path name such as c:\> \perl\bin\perl -w -e "print \ "Hello, World!\n\";" JW Charlie davis <[EMAIL PROTECTED]> wrote: >From what I can remember I am running MSDOS version 6.0 (I thank) and the version of >perl is perl 5.8 But w

Re: confused - if function

2004-04-28 Thread Jeff Westman
You are absolutely correct, that the my is included inside the { } block. But that is exactly where the confusion sets in, having had this problem when I started coding in perl. The { } are required when using an if/else construct -- part of the syntax to perform this function. Whereas a bloc

RE: Is this possible? (file handles)

2004-04-01 Thread Jeff Westman
ove a file using the FH name, not the variable name referencing it. Please see my original post below. Thanks again, JW > -----Original Message- > From: Jeff Westman [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 01, 2004 2:02 AM > To: perl_help > Subject: Is this pos

Is this possible? (file handles)

2004-03-31 Thread Jeff Westman
Hi, I want to remove an empty file using the file handle and not a variable name or literal name referencing it. Something like this: 1 #!/bin/perl 2 use warnings; 3 use strict; 4 no strict 'subs'; 5 6 open(F, "> abc") or die "cant create file: $!"; 7 cl

date format using localtime()

2004-03-12 Thread Jeff Westman
Is there a way in perl to get the month/day/year using localtime WITHOUT using 'use POSIX qw(strftime)' or a system "date" call. Something using slices, maybe something like: print scalar ((localtime(time))[4,3,7]) expecting the result to be 03122004. Trivial question, thanks in advance.

Re: remove '\' with new-line

2004-03-03 Thread Jeff Westman
david <[EMAIL PROTECTED]> wrote: > Jeff Westman wrote: > > > I need a one-liner to convert all occurances read from a Unix > pipe > > of > > > > 'backslash' + 'literal new line (hex 0a)' > > > > to become just > >

remove '\' with new-line

2004-03-02 Thread Jeff Westman
I need a one-liner to convert all occurances read from a Unix pipe of 'backslash' + 'literal new line (hex 0a)' to become just 'literal new line (hex 0a)' That is, remove the '\' only when it preceeds a new-line. Again, this must be read from a pipe. This is what I have so far, but it do

Re: Help! Perl Substitution

2004-02-19 Thread Jeff Westman
WC -Sx- Jones <[EMAIL PROTECTED]> wrote: > Jeff Westman wrote: > > > When I ran this > > > >$ perl -ne 's/|^NEWLINE^|^/\n/g;print' loadFile > > The program loads the ENTIRE loadfile and then splits characters > at > whitespace

Re: Help! Perl Substitution

2004-02-19 Thread Jeff Westman
Paul Johnson <[EMAIL PROTECTED]> wrote: > On Thu, Feb 19, 2004 at 04:36:55PM -0800, david wrote: > > Jeff Westman wrote: > > > > > I'm trying to help out another developer with a mini-Perl > script. > > > He has a file that contains one very long li

Help! Perl Substitution

2004-02-19 Thread Jeff Westman
I'm trying to help out another developer with a mini-Perl script. He has a file that contains one very long line, about 28M in size. He needs to do a replacement of all occurances of |^NEWLINE^|^ to a literal newline (HPUX, 0x0a or "\n"). When I ran this $ perl -ne 's/|^NEWLINE^|^/\n/

Re: multiline matching

2004-01-14 Thread Jeff Westman
Jose Malacara <[EMAIL PROTECTED]> wrote: > Can someone explain to me how to do multiline matching? I am > trying to extract three consecutive lines from a datafile > containing multiple records like this: Check out perldoc perlre What you should do is look at the 'm' (multiple line) option

RE: Apel of VIM was Emacs Wizards

2004-01-14 Thread Jeff Westman
Incidently, emacs has a 'dired mode' (directory editor) which is very nice... much like the old 'list' shareware in DOS land of the dark past you can bring up a list of files (like 'ls -l'), then view and selectively execute or delete all that you mark. It's very nice, and it can also be used

Re: error.

2004-01-14 Thread Jeff Westman
Eric Walker <[EMAIL PROTECTED]> wrote: > Does anyone know what this means... > code.. > for ($i = 0;$i <= $size; $i+=$temp){ > $type= split(::,shift (@hold)); > } > > Warning: > Use of implicit split to @_ is deprecated at .//test.pl line 21 Because perl is expecting an array (@_) to be re

RE:Apel of VIM was Emacs Wizards

2004-01-14 Thread Jeff Westman
Paul Kraus <[EMAIL PROTECTED]> wrote: > > (I love emacs, but vi is my tool of choice day-to-day ... much > > quicker vim is even better if you have it) > Why? I started with emacs just because it happened to be the 1st > I heard > about. Since you know both why does vim appeal to you over em

Re: Emacs Wizards

2004-01-14 Thread Jeff Westman
Paul Kraus <[EMAIL PROTECTED]> wrote: > Is there a way to easily have emacs comment out xnumber of lines. > > If something{ > Then do > Else > Do > } > > Alt 5 Ctrl - somecoolsequence I don't know > > #If something{ > # Then do > #Else > # Do > #} > > Sort of perl relat

Re: Cobol format conversion

2004-01-10 Thread Jeff Westman
John McKown <[EMAIL PROTECTED]> wrote: > FWIW - the best thing, IMO, is to change the generating program's > PIC > clause to: > > PIC S9(09)V.9(04) SIGN IS LEADING SEPARATE. > > This will take up two more characters in the output line. It will > insert > an actual decimal point and prefi

Empty Array

2004-01-02 Thread Jeff Westman
What is the proper way to test if an array is empty ? TIA -JW __ Do you Yahoo!? Find out what made the Top Yahoo! Searches of 2003 http://search.yahoo.com/top2003 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Simple Hash Question / NEVER MIND

2003-12-31 Thread Jeff Westman
DOH . DOH . NEVER MIND, user error ( <- gun to head) DOH . DOH . DOH . Hi I have a hash defined as my %flag3 = ( A => "DBSpace backup thread", B => "Begin work", C => "Commiting/committ

Simple Hash Question

2003-12-31 Thread Jeff Westman
Hi I have a hash defined as my %flag3 = ( A => "DBSpace backup thread", B => "Begin work", C => "Commiting/committed", H => "Heuristic aborting/aborted", P => "Preparing/prepared", R => "Aborting/aborted", X

Re: debugger

2003-12-22 Thread Jeff Westman
zentara <[EMAIL PROTECTED]> wrote: > On 19 Dec 2003 09:16:10 -0700, [EMAIL PROTECTED] (Eric Walker) wrote: > > >Hello all, > >When using the perl debugger, is there a way to load in the breakpoints > >and watch variables that I want from a file. I am using it now and as I > >am debugging I am fi

RE: Win32 Registry

2003-12-20 Thread Jeff Westman
yApp'} = "My Application"; > > etc., etc. Suppose I had some DATA values listed under a branch (ie, "VALUE"). How do I delete those? I'm a little bit paranoid running something I've never done and hosing my registry. Can you give me an example... TI

Win32 Registry

2003-12-19 Thread Jeff Westman
Hi, I need to access the Windows registry directly (not an exported 'reg' file). I am not familiar with Win32::Registry::File. Basically, I am trying to write a script that will do some 'cleanup' of known 'values' and 'data' strings that some uninstall applications neglect to cleanup. Any exa

RE: Align Text

2003-12-19 Thread Jeff Westman
Bill Jastram <[EMAIL PROTECTED]> wrote: Can you give an example of what you want your output to look like? >From what I am hearing you say, you probably should be using 'format', as one already responded. -Jeff > We're getting closer. But lets say the first name of the first field in the > fi

Re: alternating loop

2003-12-18 Thread Jeff Westman
Paul Johnson <[EMAIL PROTECTED]> wrote: > On Thu, Dec 18, 2003 at 07:26:03PM -0500, Randy W. Sims wrote: > > On 12/18/2003 7:00 PM, James Edward Gray II wrote: > > >On Dec 18, 2003, at 5:48 PM, Mike Blezien wrote: > > > > > >>Hello, > > >> > > >>been trying to come up with a way, while going throu

Re: foreach

2003-12-18 Thread Jeff Westman
Eric Walker <[EMAIL PROTECTED]> wrote: > I got it so I need a counter which sends me to a for loop instead of a > foreach. Thanks.. > > perlknucklehead I believe that 'for' and 'foreach' are completely interchangable. I remember reading somewhere that one was a synonym for the other. Maybe som

Re: encrypting email address (to prevent spam)

2003-12-17 Thread Jeff Westman
"Randal L. Schwartz" <[EMAIL PROTECTED]> wrote: > > "Sara" == Sara <[EMAIL PROTECTED]> writes: > > Sara> I am looking for a way to encrypt & decrypt an email addy to > Sara> prevent spam while posting a message to discussion board. > > You also asked this, and I answered it, on the Perl Beg

Re: Wrapping Unix Command into Perl /correction

2003-12-12 Thread Jeff Westman
--- Jeff Westman <[EMAIL PROTECTED]> wrote: > Anthony J Segelhorst <[EMAIL PROTECTED]> wrote: > > Anthony J Segelhorst <[EMAIL PROTECTED]> wrote: > > > > > I am trying to wrap the following Unix command into perl and having a > > few > >

Re: Wrapping Unix Command into Perl

2003-12-12 Thread Jeff Westman
ps -name "DB_*" -mtime +10 -print > -exec ls {} \;` > > !system `find /var/spool/Tivoli/backups -name "DB_*" -mtime +10 -print > -exec ls {} \;`; > > Jeff Westman wrote: > >1-- You are useing parens '( )' and should be using curly braces '{ }&#x

Re: Wrapping Unix Command into Perl

2003-12-12 Thread Jeff Westman
Anthony J Segelhorst <[EMAIL PROTECTED]> wrote: > I am trying to wrap the following Unix command into perl and having a few > issues: > > find /var/spool/Tivoli/backups -name "DB_*" -mtime +10 -print -exec ls {} > \; > > > I have tried (and nothing to seems to work): > > $temp = `find /var/s

RE: Question for this Group ... dont flame me :)

2003-12-12 Thread Jeff Westman
Guay_Jean-Sébastien <[EMAIL PROTECTED]> wrote: > These answers are of course my own experience, but may be significant to > understand the bigger picture. I reorder your points a bit in my reply :-) No problem :) > > So, why is it that most of the solutions represented > > in this group tend t

Question for this Group ... dont flame me :)

2003-12-12 Thread Jeff Westman
Question for this group. And please don't flame me for asking this. Often times one writes in, asking how to do something fairly trivial, such as a date conversion from a non-standard format, or doing something else not require too much overhead. When asked for advice, nine times out of ten, the

Re: -e with single quotes

2003-12-10 Thread Jeff Westman
Dan Muey <[EMAIL PROTECTED]> wrote: > Hello group. > > I'm tryign to do a perl -e '' command and am wondering if it is > possible to do single quotes inside the single quotes. > IE > > perl -e 'print "joe's mama";' > Obvo=iously won't work > perl -e 'print "joe\'s mama";' > And any other versio

RE: Get file size without downloading

2003-12-10 Thread Jeff Westman
Dan Anderson <[EMAIL PROTECTED]> wrote: > On Wed, 2003-12-10 at 09:42, Bob Showalter wrote: > > usef wrote: > > > > Hi, > > > > FTP or HTTP? > > > > > > > > > > HTTP, but I want to know the method for FTP as well. Thanks -u > > > > I think that will work for FTP as well. Give it a try. > > If

Re: How to verify whether a directory exists

2003-12-08 Thread Jeff Westman
"B. Fongo" <[EMAIL PROTECTED]> wrote: > I tried several alternatives to solve the problem, but failed. In most > cases, the script couldn't create a directory if there is a text file > with the same name. Rob's suggestion works better; except that it > overrides the directory without warning -

RE: Reading a log file, again

2003-12-08 Thread Jeff Westman
Tom Kinzer <[EMAIL PROTECTED]> wrote: > Try this: > > Caveat: This all assumes LOTS about the format of your data being > consistent, and so should be treated as a "quick and dirty" as opposed to > anything resembling a robust application... I'm not sure what your > intention with the script is,

Re: Syntax a little funny ....

2003-12-08 Thread Jeff Westman
James Edward Gray II <[EMAIL PROTECTED]> wrote: > On Dec 8, 2003, at 11:28 AM, Jeff Westman wrote: > > > [EMAIL PROTECTED] wrote: > > > >> Here is some syntax I found a little funny, and I was hoping somebody > >> could explain this too me: > >>

Re: Syntax a little funny ....

2003-12-08 Thread Jeff Westman
[EMAIL PROTECTED] wrote: > I've just started trying to pick up a little perl. > I'm breezing through "Learning Perl" and reading the perl docs. Excellent book. Do more than just "breeze" through it. Study it thoroughly, it's probably the single best starting place to learn perl. > Here is some

RE: Openning Files Names with Embedded Spaces

2003-11-29 Thread Jeff Westman
Tim Johnson <[EMAIL PROTECTED]> wrote: > Granted, I'm on XP, but I can't seem to reproduce your error. I created a > file at the path specified and it works perfectly. Are you sure that you > have the exact filename and that you have access to it? (I guess it's > windows 98, so you pretty much

Re: Openning Files Names with Embedded Spaces

2003-11-29 Thread Jeff Westman
Rob Dixon <[EMAIL PROTECTED]> wrote: > Jeff wrote: > > > > I am using Active Perl under Windoze 98. I am trying to open a file that > has > > embedded spaces. I tried escaping the spaces as well, and that didn't > work > > either. > > > > #! perl -w > > $file = "c:\\win\\start menu\\programs\\sy

Re: Testing Perl on a Web Page

2003-11-28 Thread Jeff Westman
"R. Joseph Newton" <[EMAIL PROTECTED]> wrote: > Try this: > > > > > Joseph's first Perl-based form > > > > > Name > Rank > Serial Number > > > > > Then use CGI to get the parameters. > > perldoc CGI I got a '405 error', resource not available. I guess I'll just have to switc

RE: Testing Perl on a Web Page

2003-11-26 Thread Jeff Westman
Dan Muey <[EMAIL PROTECTED]> wrote: > > > > Hello There, > > > > > > > > I would like to see if my ISP has perl available if one > > > > wanted to incorporate perl into a web page. Is there a quick > > > > and dirty web page I can upload to my ISP to test if perl is > > > Try this: > > > > > >

RE: Testing Perl on a Web Page

2003-11-26 Thread Jeff Westman
Dan Muey <[EMAIL PROTECTED]> wrote: > > Hello There, > > > > I would like to see if my ISP has perl available if one > > wanted to incorporate perl into a web page. Is there a quick > > and dirty web page I can upload to my ISP to test if perl is > Try this: > > test.cgi > #!/usr/bin/perl -w

Testing Perl on a Web Page

2003-11-26 Thread Jeff Westman
Hello There, I would like to see if my ISP has perl available if one wanted to incorporate perl into a web page. Is there a quick and dirty web page I can upload to my ISP to test if perl is available and works ? I would also like to see what version of perl is running ? Could someone post some

Openning Files Names with Embedded Spaces

2003-11-25 Thread Jeff Westman
Hi, I am using Active Perl under Windoze 98. I am trying to open a file that has embedded spaces. I tried escaping the spaces as well, and that didn't work either. #! perl -w $file = "c:\\win\\start menu\\programs\\system\\tbs montego\\_visit turtle beach web site.lnk"; print "file = $file\n";

Re: Printing ASCII to Hex

2003-11-18 Thread Jeff Westman
James Edward Gray II <[EMAIL PROTECTED]> wrote: > On Nov 18, 2003, at 10:33 AM, Jeff Westman wrote: > > > There must be an easier way to convert a basic ascii string to hex. I > > tried > > using ord/chr/unpack/sprintf(%x) combinations and just dug my hole >

Printing ASCII to Hex

2003-11-18 Thread Jeff Westman
Hi, There must be an easier way to convert a basic ascii string to hex. I tried using ord/chr/unpack/sprintf(%x) combinations and just dug my hole deeper. I'm not interested in using any additional modules, just straight, "basic" perl. This works, but exactly elegant: #!/bin/perl use strict; u

When MUST you use 'map' ?

2003-11-17 Thread Jeff Westman
Hi, In my limited experience with perl, I've never had to use the 'amp' command, even though I see it used all the time. It seems to just be a short-cut of other commands/keywords that I've used. So, when do you HAVE to use 'map', when no other option makes sense?! -Jeff _

Re: Using Net::FTP for chmod (help needed ASAP)

2003-11-14 Thread Jeff Westman
Wiggins d Anconia <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > Much to my surprise, when I run this code, it never returns 0 if it > could not > > carry out the operation. > > > > $rc = $f->site("chmod 666 $remoteFile") > > or die "ftp: Could not change permissions: $!\n"; > > > > I

Using Net::FTP for chmod (help needed ASAP)

2003-11-14 Thread Jeff Westman
Hi, Much to my surprise, when I run this code, it never returns 0 if it could not carry out the operation. $rc = $f->site("chmod 666 $remoteFile") or die "ftp: Could not change permissions: $!\n"; It seems to return a 2 on success, and a 5 if it could not access the file because of a di

Recursion

2003-11-01 Thread Jeff Westman
Hi, I've never liked "recursion" but of course there are times where it is needed. I have a simple task that I am trying to do. Basically, I just want to list out my directories on disk, and then chdir to each one, print it out, and so on. Pretty basic, but I have a total mental block using rec

Re: command-line

2003-11-01 Thread Jeff Westman
SilverFox <[EMAIL PROTECTED]> wrote: > hey guys, i'm trying to grep some data from a log file and getting the > following error. Any ideas??? > > [EMAIL PROTECTED] perl -e 'grep \"Eliminating movie\" update.log |awk {'print > \$5'}'; > > Can't find string terminator '"' anywhere before EOF at -

Re: Trivial 'unless' Question

2003-10-21 Thread Jeff Westman
Steve Grazzini <[EMAIL PROTECTED]> wrote: > On Tue, Oct 21, 2003 at 12:17:17PM -0700, Jeff Westman wrote: > > # ... but can I do something like > > print "first\n" unless ($counter) else { print "second\n"; > > Not really. You could use

Trivial 'unless' Question

2003-10-21 Thread Jeff Westman
Hi . very trivial ... is there a way or correct syntax to add an 'if' tp the following 'unless' statement? # this works fine ... print "first\n" unless ($counter); # ... but can I do something like print "first\n" unless ($counter) else { print "second\n"; # (syntax error) I know I can do

RE: Aliases in Perl?

2003-10-20 Thread Jeff Westman
"Bakken, Luke" <[EMAIL PROTECTED]> wrote: > > Hi, > > > > Are there 'aliases' in perl? For example, if I have a Korn > > shell script and > > a function named "increaseCost()", I can do this: "alias > > decreaseCose=increaseCost" (passing a parameter in). of > > course this is a > > simpl

Aliases in Perl?

2003-10-20 Thread Jeff Westman
Hi, Are there 'aliases' in perl? For example, if I have a Korn shell script and a function named "increaseCost()", I can do this: "alias decreaseCose=increaseCost" (passing a parameter in). of course this is a simplified example of what I want to do, but the point is to make it self-document

Re: Hash Print and Delete

2003-10-10 Thread Jeff Westman
Wiggins d'Anconia <[EMAIL PROTECTED]> wrote: > > > On Fri, 10 Oct 2003 09:11:28 -0700 (PDT), Jeff Westman <[EMAIL PROTECTED]> > wrote: > > > > > > I know perl returns the last value (statement?

Re: 2 newbie questions

2003-10-10 Thread Jeff Westman
Bee <[EMAIL PROTECTED]> wrote: > hello all, > > I've just start my learning on perl, and recently still learning some basic > syntax. > So I hope my question is still making sense. > > I am now learning about how to write files and wondering is that possible > to inserting / overwriting bytes i

Re: Hash Print and Delete

2003-10-10 Thread Jeff Westman
Rob Dixon <[EMAIL PROTECTED]> wrote: > [...snip...] > > > >return (exists $myHash{$val1} ) ? $Hash{$val2} : undef; > > > Likewise, 'delete' returns either the element deleted or 'undef' if > > > it didn't exist. > [...snip...] > > I didn't know 'delete' returned the value as well. Simple an

RE: Hash Print and Delete

2003-10-10 Thread Jeff Westman
Paul Kraus <[EMAIL PROTECTED]> wrote: > Why wouldn't you just return(shift(@myarray) Yes, this works for a normal(?) array, but I was asking about hashes. > As far as the hash why are you trying to remove it? I would assume it > because you don't have a use for it outside of the scope of the > s

Re: Hash Print and Delete

2003-10-10 Thread Jeff Westman
Rob Dixon <[EMAIL PROTECTED]> wrote: > Jeff Westman wrote: > > > > If I have an array and want to take the first element off and return it, > I > > would do it like this: > > > >return (@myArray) ? shift(@myArray) : undef; > > > > How wo

Hash Print and Delete

2003-10-10 Thread Jeff Westman
Question: If I have an array and want to take the first element off and return it, I would do it like this: return (@myArray) ? shift(@myArray) : undef; How would I do similarly with a hash? I have something like this: return (exists $myHash{$val1} ) ? $Hash{$val2} : undef; But these l

Re: Regular Expression question

2003-10-09 Thread Jeff Westman
Trina Espinoza <[EMAIL PROTECTED]> wrote: > How do you create a regular expression that allows you to have files like > ths: > Stuff_Dev > Greg_Files > myThings_ > _default > > I wrote this > > s/([A-Za-z]*)/\n$1/g; Your expression above only asked to get the letters :) You specified a chara

Perl Debugger

2003-10-09 Thread Jeff Westman
Hi, I'm using perl version 5.6.1 for Unix (HPUX-11). I would like to be able to retain my 'watches' and breakpoints in between debug sessions. Is there a way to do this with the standard debug library that comes with perl? (I know I can save these with the ptkdb package, but I cannot get that t

Re: convert UNIX timestamp

2003-10-01 Thread Jeff Westman
Mike Blezien <[EMAIL PROTECTED]> wrote: > Hello, > > how can one convert a unix timestamp to a readable date/time format. I know > there's a module to do this, but don't recall which one is used. IE. > convert the unix timestamp: 1064616515 > > thx's > Mickalo perl -e "print scalar localtime()

Re: Is there a *nix shell variable for the path to perl?

2003-09-29 Thread Jeff Westman
Dan Anderson <[EMAIL PROTECTED]> wrote: > Is there a (BA)SH/CSH/TSH/KSH variable to the Perl path? > > I am creating a script that uses Perl I want to be able to share over > several servers. Instead of having my users edit the file manually > (because I assume they would do something dumb) I wan

Order of Command Line Options

2003-09-26 Thread Jeff Westman
Hi, Why does the order of these options matter? In the first case, no output is produced, but it works correctly in the second case. I would have thought perl would have been smart enough to parse the command line options in any order. $ nslookup someServer | perl -en 'print qq($_);' $ ns

Re: Help needed on Telnet.pm

2003-09-22 Thread Jeff Westman
There is an errmode() and dump_log(). Maybe that is what you are trying to capture. perldoc Net::Telnet -Jeff --- Daniel Staal <[EMAIL PROTECTED]> wrote: > > > --On Tuesday, September 23, 2003 0:02 +0530 Pandey Rajeev-A19514 > <[EMAIL PROTECTED]> wrote: > > > Does Telnet.pm capture ou

Re: May I know the perl version of following shellscript

2003-09-22 Thread Jeff Westman
--- Saifuddin_Bohra/[EMAIL PROTECTED] wrote: > > Hi, > I am new to Perl. I have a follpwing shell script > > if [ -n "`netstat -na|grep LISTEN |grep 1099`" ]; > then > exit 0 > else > exit 1 > fi > > I need the perl script for the same job. > and how to use this in another

Re: why this is not working ??

2003-08-28 Thread Jeff Westman
--- "John W. Krahn" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > > > On Wed, Aug 27, 2003 at 11:18:26AM +0530, T.S.Ravi Shankar wrote: > > > > > > open(STATUS,">> status.txt"); > > > for ($i=0; $i<=98985;$i++) { > > > system ("process"); > > > if (($i%10)==0) > > > { print ST

RE: the File::Copy module

2003-08-20 Thread Jeff Westman
--- Saadat Saeed <[EMAIL PROTECTED]> wrote: > Hello, > > Thanks for all your inputs now below you mentioned > > copy(qq(\\machine1\share\$file),qq(\\mahine2\share\$file)) > > sorry for my ignorance but what is qq In perl, there are many things to do things "right". That is the beauty of p

RE: the File::Copy module

2003-08-19 Thread Jeff Westman
--- Dan Muey <[EMAIL PROTECTED]> wrote: > > Try: > > > > use strict; > > use warnings; > > ... > > my $returnValue = > > "copy("machine1\\share\\file1","machine2\\share\\file2"); > ^ I think that quote will cause problems. > > Have you tried single quotes also? T

Re: the File::Copy module

2003-08-19 Thread Jeff Westman
Try: use strict; use warnings; ... my $returnValue = "copy("machine1\\share\\file1","machine2\\share\\file2"); unless ($returnValue) warn "Copy failed: $!"; (not tested) -JW --- Saadat Saeed <[EMAIL PROTECTED]> wrote: > I was just reading the File::Copy module. Now on

Re: Net::Telnet - Variable won't change

2003-08-14 Thread Jeff Westman
--- SilverFox <[EMAIL PROTECTED]> wrote: > Jeff Westman wrote: > > > > > --- SilverFox <[EMAIL PROTECTED]> wrote: > >> Hey can someone help me figure out why the value of $file_exists won't > >> change even when the file is mssing Thx.

Re: Net::Telnet - Variable won't change

2003-08-14 Thread Jeff Westman
--- SilverFox <[EMAIL PROTECTED]> wrote: > Hey can someone help me figure out why the value of $file_exists won't > change even when the file is mssing Thx. > > #!/usr/bin/perl -w > $out="/home/laptop/scripts/perl/logs/resetmf.log"; > open OUT, ">>$out" or die "Unable to open $out :$!"; > >

Re: Why executable?

2003-08-14 Thread Jeff Westman
--- Ovid <[EMAIL PROTECTED]> wrote: > And as a word of caution, some like to add '.' to their path in order to > save typing an extra two > letters ('./' in front of the file name). Don't do this, though, as this > is a major security > hole. It depends on the flavor or Unix you are using. Also

Re: Telnet.pm and Unix prompt

2003-07-25 Thread Jeff Westman
Chris, --- "Vidal, Christopher, SOLCM" <[EMAIL PROTECTED]> wrote: > Using the Telnet.pm mod, How do I put my unix prompt into the PROMPT > scalar ? > > My unix profile prompt is : > > uid=`whoami` > system=`hostname` > PS1=$system" "$uid" "\\!:" " > > #! /opt/perl5/bin/perl > require '/tools/m

RE: "HTH"

2003-07-24 Thread Jeff Westman
...and here I thought it meant "hacker-to-hacker". Silly me. JW --- [EMAIL PROTECTED] wrote: > > > On Thu, 24 Jul 2003 08:32:27 -0700 (PDT), Jeff Westman <[EMAIL PROTECTED]> > wrote: > > > H

"HTH"

2003-07-24 Thread Jeff Westman
Hi, Okay guys, what does this mean? Several of you 'sign' with this. HTH (lol) JW __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional command

Re: using whence

2003-06-27 Thread Jeff Westman
> David Parker wrote: > > Hi. I have a perl script that calls various programs. I would like to be > able to verify that a given program is being called from the right place - > what I would use "whence" for in the korn shell. > > > > I tried > > > >$path = `whence $cmdname`; > > > > but I

Re: Weekly list FAQ posting

2003-06-26 Thread Jeff Westman
ok I want to bookmark this link, but it seems it is only one week's worth of questions, even though there is a "[Prev Page][Next Page]" on the page (which if it is a link, doesn't work). -JW --- Janek Schleicher <[EMAIL PROTECTED]> wrote: > case wrote at Tue, 24 Jun 2003 15:17:48 +: >

  1   2   >