On Thu, 2 Dec 2004, Nilay Puri, Noida wrote:
> > I have a file with thousands of line like : > > /abc/def/ijk/test.txt > > /pqr/lmn/test1.t > > > > I want to get the directory where the files test.txt and test1.txt are > lying. Try something like this ----------------------------------------- #!/usr/bin/perl -w use strict; while(<DATA>){ my $line=$_; chomp; if(($line=~/test\.txt/) or ($line=~/test1\.txt/)){print "$`\n"} } __DATA__ /abc/def/ijk/test.txt /pqr/lmn/test1.txt ---------------------------------------- and see if it helps Owen ps you could probably get rid of the chomp. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>