Writing a column after column

2009-03-16 Thread vd
Hi all, I need to consolidate columns of data available across different directories into a single excel csv file. Usually we write to a file row after row but for the current task I have, it would be convenient to write the file column after column. Is there a file writing mode for this? If

What could go wrong with closing an FH ?

2002-07-04 Thread David vd Geer Inhuur tbv IPlib
Hi All, After a couple of emails about opening a file with a lower case FH, I have a question. I see everyone opening a file with an or die statement, what I can fully understand. But I see you also close the FH with an or die statement. Why ? What can go wrong with closing an FH ? Can

Re: df hang inside script

2002-07-04 Thread David vd Geer Inhuur tbv IPlib
Hi Deb, Did you ever think of : open(FH, /etc/mnttab); The only thing a df (or bdf) does is catinating the /etc/mnttab and checking if the link is still there. This way a hang of a stale nfs-mount won't bother you, but you will be able to filter it out in the mnttab as it cleary sets an

Re: calling shell script from perl

2002-07-01 Thread David vd Geer Inhuur tbv IPlib
Hi, To open a file for reading do : open(CRONJOB, /home/queue/test.sh); @data = CRONJOB; close(CRONJOB); print @data; To execute a file do : system(/home/queue/test.sh, $return); or: exec(/home/queue/test.sh); Regs David Hi guys, I need to call shell executable

Regex question again

2002-06-27 Thread David vd Geer Inhuur tbv IPlib
Hi, Can you please assist. I am stuck on a regex again. my $dir = /user/IPlib/and/many/other/dirs; $dir =~ s!/[^/]*\z!!; Will make : $dir = /user/IPlib/and/many/other; ## so it takes off the last dir But how do I let it make : $dir = /IPlib/and/many/other/dirs; ## But now on the first

Re: Permission denied on a directory

2002-06-26 Thread David vd Geer Inhuur tbv IPlib
This is maybe not your only error. Of course you have to store contents of a directory like : sub getfiles { opendir(DIR, $base) or die can't open $base : $!; my @files = grep !/^\.\.?$/, readdir(DIR); # Extract the . and .. file closedir(DIR); } # End sub getfiles But if you created the

Re: send to new page?

2002-06-26 Thread David vd Geer Inhuur tbv IPlib
Hi Dennis, I solved this using Javascript. The following will show you how to open a new window for you : my $thanks = http://..;; print input type=button value=\New Window\ Onclick=\window.open('${thanks}')\ ; Maybe not exactly what you want. But the following will submit your form and

Re: search-engine, searching for 2 words

2002-06-26 Thread David vd Geer Inhuur tbv IPlib
Hi Robert, Looks good, but doens't work :) The if-statements work fine within the while-loop. After that you do something I realy don't get and my perl either :) It start complaining : Use of uninitialized value in numeric ge (=) at /user/web/apache/cgi-bin/IPlib/1 line 88, FILE line 471

Re: search-engine, searching for 2 words

2002-06-26 Thread David vd Geer Inhuur tbv IPlib
that matched, so we push the file name onto the @matches array: push(@matches, $file). Hope this helps, =-= Robert T. On Wed, Jun 26, 2002 at 02:07:39PM +0200, David vd Geer Inhuur tbv IPlib wrote: Hi Robert, Looks good, but doens't work :) The if-statements work fine within

Re: Running Modules

2002-06-25 Thread David vd Geer Inhuur tbv IPlib
Hi, Don't forget to close the FH : close(DEMO_LOG); Regs David - Greetings All, I have the following code, from which I attempt to call the module “Test” #!/usr/local/bin/perl ### ### Program name: demo.pl ### Created By:Theresa Mullin require cgi.lib;

RE: if-statement and grep in one go

2002-06-25 Thread David vd Geer Inhuur tbv IPlib
Hello, Thanks for the solution Bob. Changed some stuff and have 2 questions open. my $line; my (%u, %g); open(FILE, ${dir}/user.perm) or print Failed opening file $!; ## 1 while ($line = FILE) { ## 2 if ($line =~ /^user:/) {

Re: changing user password

2002-06-24 Thread David vd Geer Inhuur tbv IPlib
Hi Pavel, I know that perl mostly doesn't like the sticky-bits on files such as : -r-sr-xr-x 1 root bin 24576 Aug 6 1998 /usr/bin/su He just doesn't executes them. Personaly I haven't found a solution for this. I know a collegue of mine has written a C-programm around it.

Re: text problem

2002-06-24 Thread David vd Geer Inhuur tbv IPlib
Hi, Multiple ways of doing this : #!/usr/bin/perl use strict; my $logfile = ...; open(FH, $file); my @contents = FH; close (FH); print pre @contents /pre; # - or print tabletrthUSER/ththPID/ththPPID .. /th/tr; foreach $line(@contents) { ## $line =~

Re: Reading File

2002-06-24 Thread David vd Geer Inhuur tbv IPlib
Hi, I added one. The seek didn't work. I don't have the ReadBackwards, but at least some timeing results : Benchmark: timing 1 iterations of complete, frk, pop... complete: 21 wallclock secs (16.93 usr + 0.80 sys = 17.73 CPU) @ 564.02/s (n=1) frk: 83 wallclock secs ( 1.34

Re: My script can't upload the data

2002-06-18 Thread David vd Geer Inhuur tbv IPlib
Hi, It looks like some stuff is mixed up. Who is what ?? $foto ?? $path/$number/$foto ?? Let's make this difference : if($picture) { ## If possible of course open(F, $path/$number/$foto) || die Cannot open $!; Now what do you want to store into this file. You opened the file in

Re: cgi report from another server

2002-06-13 Thread David vd Geer Inhuur tbv IPlib
Hi Martin, This is because you didn't use the back-tick's : $stuff=`rsh server2 -l user /bin/uname -X`; (Don't mix them up with the ' ); This will actualy execute the command, currently you only set a var. Also system() and exec() could help you out. Regs David Hi everybody, I don't

Re: Help With Perl

2002-06-12 Thread David vd Geer Inhuur tbv IPlib
Ok, what is it that you want? It's hard to read when the code is split up over the page. Maybe it already answered your questions ?? #!/usr/local/bin/perl # $username = param('username'); open(USER, user.dat); while (USER) { chomp; ($name, $site, $site_id, $des, $email, $pass) =

More efficient ??

2002-06-12 Thread David vd Geer Inhuur tbv IPlib
Hello, Last time I got so much feedback that I will try it again. I learned a lot of the last recommendations, but the next issue could not be made more efficient by me. Can you ? #!/usr/local/bin/perl # my $base = /user/IPlib/IPlib/Analog_CMOS/Camera; ## Set temporarily for this test,

Re: Simple Substitution

2002-06-12 Thread David vd Geer Inhuur tbv IPlib
Nope, open(CONFIG, /home/mnorris/$first_file) || die Sorry, I couldn't READ /home/mnorris/$first_file\n; while (CONFIG) { s//$first_var/; push @newdata, $_; } close(CONFIG); open(NEWCFG, /home/mnorris/$first_file) || die Sorry, I couldn't WRITE to

Re: modify UID in /etc/passwd file ?

2002-06-12 Thread David vd Geer Inhuur tbv IPlib
HI Frank, You can use this one : #!/usr/local/bin/perl my $file = /etc/passwd; my $temppwfile = /etc/tmppasswd; $teller = 5000; open(PW, $file); open(NEWPW, $temppwfile); while (PW) { ($user, $pw, $uid, $grpid, $descr, $home, $shell) = split(/:/); $newline =

How to communicate with local ports

2002-06-11 Thread David vd Geer Inhuur tbv IPlib
Hi, My collegue is looking for a solution (Cpan module) to be able to communicate on a low level with for example a printer-port. He has designed a specific type of hardware, and needs to send signals to that port. Currently he is using C to do the work, but wants to rewrite it in Perl. Any

s/foreach/??/g

2002-06-11 Thread David vd Geer Inhuur tbv IPlib
Hi, I am currently almost done with my current job. As I am reviewing my scripts the foreach-loop started to anoy me. I am afraid this is slowing down the script. Does anyone know a faster way to do the following : # -- open(FH, $groupfile); @usrs = FH; close FH; $htusr = (grep

Re: s/foreach/??/g

2002-06-11 Thread David vd Geer Inhuur tbv IPlib
$group. Any suggestions about a faster foreach ?? Regs David David vd Geer Inhuur tbv IPlib wrote: Hi, I am currently almost done with my current job. As I am reviewing my scripts the foreach-loop started to anoy me. I am afraid this is slowing down the script. Does anyone know

Thanks s/foreach/??/g

2002-06-11 Thread David vd Geer Inhuur tbv IPlib
I really have to thank you all !! I got so many replies, with hardcore answers. I need some time for that. But I really apreciate all of your excellent help ! Regs David One day, I hope to be as good as the best... One day.. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: Checking environment variables...outputting to file

2002-06-11 Thread David vd Geer Inhuur tbv IPlib
Hi, There should be many ENV that would only be set if you are using a browser, but one of them might be HTTP_USER_AGENT. Here is a tested example : # if($ENV{'HTTP_USER_AGENT'}) { print Content-type: text/html\n\n; print You are using a browser; } else { print You have started this

Re: Spaces...

2002-06-10 Thread David vd Geer Inhuur tbv IPlib
Hi Paul, Just use : ($month, $day, $time) = (split /\s+/, $line); the /s+ stands for 1 or more spaces. Regs David - I have a logfile that has the following format: month day time The problem is splitting on the space - split(/ /). Sometimes there are more than one

print

2002-06-06 Thread David vd Geer Inhuur tbv IPlib
Hi, I am struggling with something very stupid. I know the print syntax, but I would like to use the print EOF I have been searching all books for the exact syntax, but just can't find it. Can anyone help ? Exa: print EOF All these lines will have to be printed until I give an: EOF

skip first array entry and exit foreach loop only

2002-06-04 Thread David vd Geer Inhuur tbv IPlib
Hi, I am looking for a nice solution for the following problem : I have a directory stored in $header. I need to seek each directory for a specific file, but I have to start in the deepest dir and than go upwards. Using the split @header first value is always empty as it is splitting on */*.

RE: skip first array entry and exit foreach loop only

2002-06-04 Thread David vd Geer Inhuur tbv IPlib
Hi, This is indeed much faster, just substitute the last directory off of the path when you're done checking with the current. Looks better indeed !! Nikola, using File::find searches all the files and as the directory's can hold many files and directory's I prefer to just do the test on 1

Re: reference to an array

2002-05-28 Thread David vd Geer Inhuur tbv IPlib
Hi Willy, What does push and what is $_ That will probably be your question. Here is one example : open(FH, $file); while FH { ## FH is the File Handler we just openened with open ## We do something with ?? ## Yes, no var is set but instead we use $_ for the current line. ## Now we

Re: checking for an empty string

2002-05-28 Thread David vd Geer Inhuur tbv IPlib
while (STDIN) { if (!($_)) { if(m/^email address/) { } } } I think you want to be shure that you have input, so you match only if the current line is not empty. Regs David -- Hi guys, while($line = STDIN) { if ($line =~ /^email address/) {

Re: cisco log parsing

2002-05-27 Thread David vd Geer Inhuur tbv IPlib
Hi Hernan, First I would like to say please start using perl instead of system calls. This makes life a lot easier, I know I did it as well, but try to find solutions for you system calls : open (FH, logprueba.log) @logprueba = FH; close FH; Now you can start filtering : foreach

Remove 1 or more whitespaces at the end of $_

2002-05-27 Thread David vd Geer Inhuur tbv IPlib
Hi, I know how to delete 1 or more whitespaces at in a line using : while IN { s/\s+//g; } close IN; #- But How do I specific delete 1 or more whitespaces at the end of the line ? using : while IN { s/$\s+//g; } close IN; Didn't work. Does anyone have the

Re: AW: Remove 1 or more whitespaces at the end of $_

2002-05-27 Thread David vd Geer Inhuur tbv IPlib
. Just try it out. Heiko -Ursprüngliche Nachricht- Von: David vd Geer Inhuur tbv IPlib [mailto:[EMAIL PROTECTED]] Gesendet: Montag, 27. Mai 2002 14:49 An: [EMAIL PROTECTED] Betreff: Remove 1 or more whitespaces at the end of $_ Hi, I know how to delete 1 or more

How to use crypt ??

2002-05-23 Thread David vd Geer Inhuur tbv IPlib
Hi, Right now I am a little lost myself. Trying to use crypt() to encrypt a given password. I know how to compare a given password with an encrypted one, but to encrypt one myself and save it, doesn't work for me for some reason. You would say, Ah of course forgotten to give your encryption

Re: Perl script idea

2002-05-23 Thread David vd Geer Inhuur tbv IPlib
Hi Jonathan, I am not writing the script for you but at least some code I used to something similar. --- $entry = `ypmatch $userid passwd 2/dev/null`; @entry = split /:/, $entry; $encrypted = $entry[1]; $pwuser = $entry[0]; chomp($pwuser); chomp($userid); if (!($userid)) {

How to use crypt ??

2002-05-23 Thread David vd Geer Inhuur tbv IPlib
Hi, Right now I am a little lost. Trying to use crypt() to encrypt a given password. I know how to compare a given password with an encrypted one, but to encrypt one myself and save it, doesn't work for me for some reason. You would say, Ah of course forgotten to give your encryption key.

Re: command-line commands within a Perl script

2002-05-23 Thread David vd Geer Inhuur tbv IPlib
Hi, A possible way : #--- use File::Find; use File::stat; my $directory = /user/IPlib/IPlib/; find(\search, $directory); } sub search() { my $file = $File::Find::name || shift; if ( -d $file ) { push @dirs,$file; } else { push @files,$file; } print @files; print @dirs;

How to get REMOTE_GROUP

2002-05-22 Thread David vd Geer Inhuur tbv IPlib
Hi There, I have a question about Perl in combination with Apache. You can set restricted areas within Apache to force autentication. Afterwards you can read the userid using : my $user = ($ENV{'REMOTE_USER'}); But as you can see below, there also is a group called htuser in this case. Does

Re: HTML tables?

2002-05-22 Thread David vd Geer Inhuur tbv IPlib
Hi Barry, I have been looking for you, but the only options I could find in Perl in a Nutshell is the following : Form Generation start_html Generates an HTML tag. end_htmlGenerates an /HTML tag. autoEscape Sets whether to use automatic escaping. isindex

Re: perl-Tk static

2002-05-15 Thread David vd Geer Inhuur tbv IPlib
Hi Drieux, Hhhm, Unix rules, but we still need men : make babies Make: Don't know how to make babies. Stop. Hope he didn't mess up someone elses test too much :) Regs David --- On Wednesday, May 15, 2002, at 04:34 , Alan Drew wrote: [..] For static linking the

pass values to another scipt

2002-05-14 Thread David vd Geer Inhuur tbv IPlib
Hi All, I am currently having the same problems as Sven. I tried to get some info on it as wel, but it seems a difficult one. I have made a simple example to explain it a little : HTML-CODE: --- html form method=post action=/cgi-bin/david/1.cgi table input type=hidden name=hide1 value=secure

Re: pass values to another scipt

2002-05-14 Thread David vd Geer Inhuur tbv IPlib
:36 PM, David vd Geer Inhuur tbv IPlib wrote: Hi All, I am currently having the same problems as Sven. I tried to get some info on it as wel, but it seems a difficult one. I have made a simple example to explain it a little : HTML-CODE: --- html form method=post action

Re: Pattern matching

2002-05-14 Thread David vd Geer Inhuur tbv IPlib
Hi Francesco, You could do it like this : $line = qw001234po001234 ghjkldzx001234 tgbnhy; ($pw0,$uid1,$pw1,$uid2,$pw2) = split(/\s+/, $line); print NEWFILE $uid1 $pw1 \n; print NEWFILE $uid2 $pw2 \n; Your current file does have to contain 5 fields. Hope this is what you are

Re: Split

2002-05-14 Thread David vd Geer Inhuur tbv IPlib
Hi Fransesco, Let's try this one then :) ($username, $name) = split(/:/, $line); chomp($username); chomp($name); I think you just learned chomp :) Regs David - I haven't yet resolved my problem with pattern matching and I'm in front of another problem. I have a file

Re: Accessing form elements before submit..

2002-05-07 Thread David vd Geer Inhuur tbv IPlib
Hi Onkar, Yes there is a solution, Javascript :) Maybe you'dd take a look at : http://codepunk.hardwar.org.uk/bjs.htm Believe me, it's easier than you think. Good luck. David Hi , I badly need ur help regarding to the CGI scripts. i have written one perl script to design a tree ,with

Re: Graphics Library

2002-05-07 Thread David vd Geer Inhuur tbv IPlib
Hi Arran, I know there is one called GD : http://search.cpan.org/doc/LDS/GD-1.38/GD.pm Unfortunetly I have never used it yet, but I am sure someone has. It's just that they are not awake yet, the guru's awake at aprox 16:00 CET :) That's why I start late :) Good luck! Regs David

How to get number of characters from var?

2002-05-07 Thread David vd Geer Inhuur tbv IPlib
Hi, I have a question about determine how many charactars contain a var. Does anyone know, there will probably be a simple command, but I can't find it. Assuming $_ = /hello/this/will/have/to/be/IMPORTANT/ONLY/AND/CAN/BE/LONG/features.txt $dir = substr($_, 0, -13); ## Remove

a href Vs Form post

2002-05-06 Thread David vd Geer Inhuur tbv IPlib
Hi, I am strugling with my program that list the contents of a directory. Ones the directory contains files and you have permission it shows you a doc icon else it will show a directory-map followed by it's name as an a href The problem I have now is that using the a href command will have to

Re: select from oracle and write to file

2002-05-01 Thread David vd Geer Inhuur tbv IPlib
Hi Garrett, Not shure if this is where you are looking for, but here is some simple info on how to write data to a file. If it is not sufficient you'll have to wait for the real ones to wake up :) $file = /path/to/file; open(F, $file); print F What you want to store in your file, can also be

How to fill and use Hashes

2002-05-01 Thread David vd Geer Inhuur tbv IPlib
Hi There, I have never used hashes before, althought they seem to be interesting I didn't know the exact use for it. But as times are changing I think I just came to a point where I need a hash, but how do I create one and how do I use it ? Can anyone assist ? this is what I want to accomplish

Re: Editing Root File

2002-05-01 Thread David vd Geer Inhuur tbv IPlib
Hi Hengky, I assume you work on a Unix server (root). Create a shell-script might be one of the solutions : -r-sr-x--- 1 root apache 24576 Aug 6 1998 /dns.sh You can put in here the exact command you want to run as root. Make sure the file is owned by root and the group is

history.back() does not work in IE

2002-04-25 Thread David vd Geer Inhuur tbv IPlib
Hi there, I am writing a CGI-script (using Perl of course! :). Ones the submit button is hit I check if some specific var's are set. If not I give them some output and a back button { input type=submit Onclick=window.history.back() } This works on Netscape, but not on IE. IE looses all of

RE: history.back() does not work in IE

2002-04-25 Thread David vd Geer Inhuur tbv IPlib
- From: David vd Geer Inhuur tbv IPlib [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 11:18 AM To: [EMAIL PROTECTED] Subject: history.back() does not work in IE Hi there, I am writing a CGI-script (using Perl of course! :). Ones the submit button is hit I check if some

RE: history.back() does not work in IE

2002-04-25 Thread David vd Geer Inhuur tbv IPlib
Showalter [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 11:43 AM To: 'David vd Geer Inhuur tbv IPlib'; [EMAIL PROTECTED] Subject: RE: history.back() does not work in IE -Original Message- From: David vd Geer Inhuur tbv IPlib [mailto:[EMAIL PROTECTED]] Sent: Thursday, April

Re: Unix to dos; dos to unix...

2002-04-25 Thread David vd Geer Inhuur tbv IPlib
Hi There, Just a small addition on the remarks : I don't know if you realy want this to automate, but vi can do it as well. Just type : :1,$s/[Ctrl + v] [Ctrl + m]//g The [Ctrl + v] makes you able to type in an escape character. Most of all the [Ctrl + m] (^M) is bothering you. :) I know, I

Re: http headers

2002-04-24 Thread David vd Geer Inhuur tbv IPlib
Hi There, Here is another one I always use : sub parse_form { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); if (length($buffer) 5) { $head = $ENV{QUERY_STRING}; } @pairs = split(/\?/, $head); # split vars using ? as delimitor foreach $pair(@pairs) {

Re: http headers

2002-04-24 Thread David vd Geer Inhuur tbv IPlib
Hi There, Here is another one I always use : sub parse_form { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); if (length($buffer) 5) { $head = $ENV{QUERY_STRING}; } @pairs = split(/\?/, $head); # split vars using ? as delimitor foreach $pair(@pairs) {