Replace this line : if ($line =~ /^dn:\s+uid=(s\d{2}-\d{1}-\d{1}-\d{1,3})/) { With this line.(It will work for both the s06-1-3-048 and the arup etc.) if ($line =~ /^dn:\s+uid=(s\d{2}-\d{1}-\d{1}-\d{1,3}|\w+)/ ) { Unfortunately I'm not an expert. I just read a few books and this list etc. At the moment I'm struggling myself with a piece of data I cannot get parsed!!! Good luck Ian On Mon, Aug 17, 2009 at 2:12 PM, Jyotishmaan Ray <jyotishmaan@yahoo.com>wrote: > > Thanks, a lot can you do this too. > > If the input file is as the file enclosed, I need the uids gien in this > file to be listed in another file in this order :- > > arup > fazal > ujwala > > Please send me the perl script for this, immdiately as I need to extract > the uids fo neary 100's. > > > 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 > > > > > > ------------------------------ > *From:* Ian <pcs305@gmail.com> > *To:* beginners@perl.org > *Sent:* Monday, August 17, 2009 11:55:23 PM > *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) > > 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 > > > > > > -- Ian http://www.cicsworld.comThread Previous | Thread Next