develooper Front page | perl.beginners | Postings from April 2002

Re: grep

Thread Previous
From:
Eric Plowe
Date:
April 2, 2002 21:55
Subject:
Re: grep
Message ID:
6891434C-46C7-11D6-9256-003065A95F3E@hypoflux.net
Mandar,

Grep will work in perl.. tho you could do it otherways..since you're 
asking about grep..i'll do it with grep...

I a sure you're familar with how to open and read a directory..etc..so I 
wont add that... here ya go

@filesearch = (grep /[gG]/, @files)  //the [gG] searches for any 
instance of g or G - etc

foreach $filesearched (@filesearch) {
  print "$filesearched\n"
}

~Eric

On Tuesday, April 2, 2002, at 11:53 PM, Mandar Rahurkar wrote:

> Hi,
>   I need to select particular files from list that looks like this :
>
> 2168a5_vow_band_1.fea
> 169b2_vow_band_1.fea
> 2168d6_vow_band_1.fea
> 169g3_vow_band_1.fea
> neutral.txt
>
> This is how the list if files look like.I need files with only g for
> eg
> I can do it in linux as follows :
> but this doesnt work in perl :
> ls ???[g][^1] *.fea
> ls ???[^g][^1] *.fea
>
> I tried using :
> exec(`ls ???[d][^1]*.fea > temp.neutral`) in perl doesnt work.
>  Please help...
>
> Many Thanks
> Mandar
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Tax Center - online filing with TurboTax
> http://taxes.yahoo.com/
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
>


Thread Previous


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