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

Re: grep

Thread Previous | Thread Next
From:
Mandar Rahurkar
Date:
April 2, 2002 22:23
Subject:
Re: grep
Message ID:
Pine.GSO.4.33.0204022310290.20020-100000@cslr.Colorado.EDU
Hi,
  thanks to everyone for replying however I think i failed to define the
problem accurately :

i have files assigned to @files variable :

2168a5_vow_band_1.fea
169b2_vow_band_1.fea
2168d6_vow_band_1.fea
2168d5_vow_band_1.fea
169g3_vow_band_1.fea
neutral.txt

And i want the files say for eg suffix d and 1 and with extension fea.The
thing is if i try to match d all will get matched for obvious reason.

basically I wanna generate the same output as of the following command on
shell prompt :
ls ???[g][^1] *.fea
** will generate all files whose 4th char is g followed by character which
is not 1.

ls ???[^g][^1] *.fea

Many Thanks....please do send in ur replies.

Mandar


On Wed, 3 Apr 2002, Sudarsan Raghavan wrote:
2168a5_vow_band_1.fea
> > 169b2_vow_band_1.fea
> > 2168d6_vow_band_1.fea
> > 169g3_vow_band_1.fea
> > neutral.txt
> >

> 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
> >
> > 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 :
>
>      Use the glob operator (perldoc -f glob and perldoc File::Glob)
>      For e.g. to list files that start with 16
>      perl -e 'print "$_\n" while (<16*>)'
>                                                         ^^^^^
>                                                        This is the how
> the glob operator is used for this e.g.
>
>
> >
> > 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
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
>


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