develooper Front page | perl.beginners | Postings from August 2009

Re: Attentipn Please!! Need A Perl script to read the UIDs from two text files having the details in the format as given in the file(lLDIF format)

Thread Previous | Thread Next
From:
Ian
Date:
August 17, 2009 11:25
Subject:
Re: Attentipn Please!! Need A Perl script to read the UIDs from two text files having the details in the format as given in the file(lLDIF format)
Message ID:
6845b8890908171125l52f5da37r52d1c4918d72bb58@mail.gmail.com
This will do it.
I don't exactly know what you mean by "neatly written" but your email may
mangle the formatting of the program.
Can't do anything about that.
The results will be in uidf.txt.

_____________________________________________________________
use strict;
my $inpf = 'student.txt';
my $uidf = 'uidf.txt';
open (DATA, $inpf) or die "Can't open file $inpf!\n";
open (UIDF, ">$uidf") or die "Can't open output file!\n";

#read file
my $line;
while ($line = <DATA>) {
        chomp($line);

    if ($line =~ /^dn:\s+uid=(s\d{2}-\d{1}-\d{1}-\d{1,3})/) {
            print UIDF ("$1\n");
    }
}
close (DATA, UIDF);

END;
______________________________________________________________


Good luck
Ian


On Mon, Aug 17, 2009 at 12:34 PM, Jyotishmaan Ray <jyotishmaan@yahoo.com>wrote:

> Please send me your perl script in neatly wriiten manner.
>
> I need the uids only in  another text file in line by line fashion.
>
> uid means  s06-1-1-002 etc.
>
>
>
> basically the  output file should contain the entries like this :-
>
> s06-1-1-002
> s06-1-1-006
>  .
>  .
>  .
>  .
>
>
> So pease do send me accordingly urgently.
>
>
>
> Thanks,
> Jyotishmaan Ray
> Moderator Of Spirituality-Paradise Group
> http://yahoogroups.com/group/Spirituality-Paradise
>
> Are You Spiritually Aware  !!! Are You Enjoying Yourself  !!!  See What All
> You Had Been Missing !!!!
> Please Join Immediately By Sending A Blank Mail @
> Spirituality-Paradise-subscribe@yahoogroups.com
>
>

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About