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