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 not,

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) { ($name

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,

Re: select from oracle and write to file

2002-04-30 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 al

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 t

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 featur

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: 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

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 tag. end_htmlGenerates an tag. autoEscape Sets whether to use automatic escaping. isindex Generates an ta

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. That'

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 @dir

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 { s/\s+//g; } close IN; #- But How do I specific delete 1 or more whitespaces at the end of the line ? using : while { s/$\s+//g; } close IN; Didn't work. Does anyone have the solutio

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

2002-05-27 Thread David vd Geer Inhuur tbv IPlib
chop command is what you are looking for I think. > Just try it out. > > Heiko > > >>-Ursprüngliche Nachricht- > >>Von: David vd Geer Inhuur tbv IPlib > >>[mailto:[EMAIL PROTECTED]] > >>Gesendet: Montag, 27. Mai 2002 14

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 { ## 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 ca

Re: checking for an empty string

2002-05-28 Thread David vd Geer Inhuur tbv IPlib
while () { 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 = ) > { > if ($line =~ /^email address/) > { >

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 fil

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 <

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 tha

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 adv

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 = ; close FH; $htusr = (grep {/htuse

Re: s/foreach/??/g

2002-06-11 Thread David vd Geer Inhuur tbv IPlib
manualy and set it's $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.

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 comman

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 t

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, norm

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 () { s//$first_var/; push @newdata, $_; } close(CONFIG); open(NEWCFG, "> /home/mnorris/$first_file") || die "Sorry, I couldn't WRITE to /home/mnorris/$first_f

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 () { ($user, $pw, $uid, $grpid, $descr, $home, $shell) = split(/:/); $newline = "${user}:${pw}:${telle

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 overwr

Re: Web client & JavaScript

2002-06-23 Thread David vd Geer Inhuur tbv IPlib
Hi, I have no-one seen responding to your e-mail. I have done some tricks to submit a form with a href link and I have a solution to change the location, by just adding an extra value to it. I don't know how your external page looks up incoming vars, but you might want to test it in post and g

if-statement and grep in one go

2002-06-24 Thread David vd Geer Inhuur tbv IPlib
Hi, I need some help on the following. In my script I show users some infodocs after they are verified to be valid users. Users can have the permissions following the ruleset: - user (all perm) - group (all perm), - descr (Not allowed to actualy open this document). Now I do the following in

Re: Reading File

2002-06-24 Thread David vd Geer Inhuur tbv IPlib
I am try-ing to work something out with seek for you, but just can't find it yet. This is how far I am yet : #!/usr/bin/perl use strict; my $file = "..."; open(FH, "<$file"); seek(FH,2,2); my $curpos = tell(FH); $_ = ; my $lastline = ; close(FH); print "$lastline \n"; print "$curpos \n"; # -

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 usr

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 = ) { ## 2 if ($line =~ /^user:/) {

search-engine, searching for 2 words

2002-06-25 Thread David vd Geer Inhuur tbv IPlib
Hello, I am currently working on a search-eingine for .txt files I am searching for $word in each .txt file. Now of course the ability to search for 2 words in the document, must become possible. Does any of you have an idea how to compare two hashes for the same entries ? I will show you :

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 " "; Maybe not exactly what you want. But the following will submit your form and then change the location : # function T

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, line 471 Any id

Re: search-engine, searching for 2 words

2002-06-26 Thread David vd Geer Inhuur tbv IPlib
>strings were found, we want to make sure test1 and test2 above are true in our if >statement: if ( (test1) && (test2) ) { code }. If both are true, we want to record >the $file that matched, so we push the file name onto the @matches array: >push(@matches, $file). > >

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 fir

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 = ; 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 executabl

make yp oneliner

2002-07-01 Thread David vd Geer Inhuur tbv IPlib
Hi, Does anyone know how to make it a one-liner ?? @regel = split(/ /, `ypmatch IPlib auto.setuser`); chomp @regel; If anyone has suggestion to use NIS within Perl that is welcome also (with examples :). Regs David -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mai

RE: make yp oneliner

2002-07-01 Thread David vd Geer Inhuur tbv IPlib
hhh${_}hhh \n " foreach @regel; --- Regs David - > you should have seen this one coming. > > chomp( @regel = split(/ /, `ypmatch IPlib auto.setuser`) ); > > > -Original Message- > > From: David vd Geer Inhuur tbv IPlib &g

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: Validate linux user

2002-07-04 Thread David vd Geer Inhuur tbv IPlib
Hi, I hope you are using apache. If so, can easily let apache do the authentication, just set the following in your access.conf : AuthName "RESTRICTED ACCESS" AuthType Basic require group htuser and others AuthUserFile /user/web/apache-1.3.20/Security/myapp/users AuthGroupFile /