Re: NIS map lookup

2008-01-23 Thread Vahid Moghaddasi
On Jan 23, 2008 4:47 PM, Tom Phoenix <[EMAIL PROTECTED]> wrote: > > That's probably because you generally need the same compiler options > (and the same compiler) when building extensions to your perl binary > as were used to build the binary itself. > Most likely you are correct, the perl was alr

Re: NIS map lookup

2008-01-23 Thread Vahid Moghaddasi
On Jan 23, 2008 2:56 PM, Tom Phoenix <[EMAIL PROTECTED]> wrote: > > it is hard coded to use cc compiler instead of gcc. > > Where did you get that idea? > The Makefile generated by perl Makefile.PL has compiler options for cc that wont work for gcc. > I see several success reports from Solaris m

Re: NIS map lookup

2008-01-23 Thread Vahid Moghaddasi
On Jan 23, 2008 11:40 AM, John W. Krahn <[EMAIL PROTECTED]> wrote: > > http://search.cpan.org/~esm/Net-NIS-0.43/NIS.pod > > > > As a special case, the magic map __YPMASTER can be used as an equivalent I had attempted to install this module on Solaris but gave me so many errors during compilation t

NIS map lookup

2008-01-23 Thread Vahid Moghaddasi
Hi all, I am trying to modify a korn shell script to Perl to get rid of sed, awk, etc... For most part I am done but I cant seem to be able to find an included or CPAN module to lookup NIS maps, such as password, group.. and also "ypwhich -m" I will need to get the name of the maps and dump each ma

Re: perl intersect problem

2008-01-23 Thread Vahid Moghaddasi
On Jan 23, 2008 12:58 AM, Chas. Owens <[EMAIL PROTECTED]> wrote: > > Ah, I always get bitten by that. It needs to be > > print $out $_; > Sorry for the quick post, I figured it ou after the post. > snip > > Shouldn't my code keep one of the duplicate users instead of taking > > them both out? >

Re: perl intersect problem

2008-01-23 Thread Vahid Moghaddasi
On Jan 22, 2008 11:15 PM, Tom Phoenix <[EMAIL PROTECTED]> wrote: > What about this data? > > fred:x:42:42:Fred Flintstone:/home/fred:/bin/bash > barney:x:99:99:Barney Rubble:/home/barney:/bin/bash > fred:x:69:69:Fred Astaire:/home/fred:/bin/bash > dino:x:69:69:Dino:/home/dino:/bin/bash > I see

Re: perl intersect problem

2008-01-22 Thread Vahid Moghaddasi
On Jan 22, 2008 9:31 PM, Chas. Owens <[EMAIL PROTECTED]> wrote: > > Off hand I think that would only happen if the user name or the uid > was the same for some of your users. Can you present a cleaned up > version of your data the exhibits the problem? Also, You might want > to rewrite your loop

Re: perl intersect problem

2008-01-22 Thread Vahid Moghaddasi
On Jan 22, 2008 9:24 PM, Tom Phoenix <[EMAIL PROTECTED]> wrote: > On Jan 22, 2008 5:49 PM, Vahid Moghaddasi <[EMAIL PROTECTED]> wrote: > > > I have the following > > subroutine to sort unique a UNIX password file based on UID and > > username. > > Does

perl intersect problem

2008-01-22 Thread Vahid Moghaddasi
Hi, I have a very strange problem (to me anyways). I have the following subroutine to sort unique a UNIX password file based on UID and username. But the problem is that some of the users get disappeared the output password file. I couldn't figure out the pattern of user disappearance but always t

Re: grep from one file and write to another

2007-06-24 Thread Vahid Moghaddasi
On 6/24/07, Tom Phoenix <[EMAIL PROTECTED]> wrote: On 6/23/07, Vahid Moghaddasi <[EMAIL PROTECTED]> wrote: But maybe you need the actual password file. You got it, I have to read /etc/passwd file only. > I am not sure how much I can read into memory space without af

Re: grep from one file and write to another

2007-06-23 Thread Vahid Moghaddasi
On 6/23/07, Tom Phoenix <[EMAIL PROTECTED]> wrote: > use File::Copy; Are you actually using File::Copy? I didn't find any call to it in your posted code. Sorry, I left it in by mistake. This code is a small part of a very large program. > use strict; > use warnings; That's good > $|=1

grep from one file and write to another

2007-06-23 Thread Vahid Moghaddasi
Hi all, I am trying to read a colon delimited text file (filter.in) then search for each field in another file (/etc/passwd) and if it is found then write that line in the third file (passwd.out). Here is what I have written so far but it is not given me the correct result. Thanks for any help.

Re: writung to file

2007-06-21 Thread Vahid Moghaddasi
On 6/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: On Jun 21, 1:10 pm, [EMAIL PROTECTED] (Chas Owens) wrote: > print $out $_ unless $h{(split ':')[0]}++; Just curious - why are you coding around possible duplicates? Can a passwd file have duplicate entries? This is a part of a l

writing to file

2007-06-21 Thread Vahid
Hi all, I have the following code to sort UNIX's password file, it works fine but can only display on stdout. How can I make it write the output to a file? Thanks, #!/bin/perl -w # use strict; open(myFILE, '|-','awk','-F:','s[$1]++==0' ) or die $!; open(passwdFH, "passwd"); while () { print myFILE

Re: writung to file

2007-06-21 Thread Vahid Moghaddasi
On 6/21/07, Chas Owens <[EMAIL PROTECTED]> wrote: Well, first you don't use awk inside of Perl. This is about as useful as riding a bike on a bus. Thanks, that worked very well for me. Beside the force of habit, awk was the only way I could get the password file sorted unique and always keep

writung to file

2007-06-21 Thread Vahid Moghaddasi
Hi all, I wrote the following simple code to sort UNIX's password file, it works fine but I can only display the ouput on the stdout. How can I make it write the output to a file? Thanks, #!/bin/perl -w # use strict; open(myFILE, '|-','awk','-F:','s[$1]++==0' ) or die $!; open(passwdFH, "passwd")