[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: regular expression?



Of course, a regex is overkill in the below example; the equivalent is:

while (<DIRLIST>) {
	next unless $_ eq 'index.html';
	....
}

ap

----------------------------------------------------------------------
Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology  
Chapel Hill, North Carolina, USA - http://demog.berkeley.edu/~aperrin
        aperrin@socrates.berkeley.edu - aperrin@igc.apc.org
On Thu, 15 Feb 2001, Ben Collins wrote:

> On Thu, Feb 15, 2001 at 07:22:31PM -0600, William Jensen wrote:
> > Greetings,
> > 
> > I am trying to find a regular expression that will include every file
> > in a directory except one named one.  For example if I had a file
> > called index.html and then hundreds of other .html files in the same
> > directory, how can I do a reg expression to say "all the .html files"
> > except index.html?  Been rack'n my brain on this one for a bit of time
> > and I could use some help from someone more experienced.
> 
> Note sure in what context you are doing this, but in perl I would do:
> 
> while (<DIRLIST>) {
> 	/^index.html$/ and next;
> 	....
> }
> 
> and in shell
> 
> for file in `ls * | egrep -v '^index.html$'`; do
> 	....
> done
> 
> Ben
> 
> -- 
>  -----------=======-=-======-=========-----------=====------------=-=------
> /  Ben Collins  --  ...on that fantastic voyage...  --  Debian GNU/Linux   \
> `  bcollins@debian.org  --  bcollins@openldap.org  --  bcollins@linux.com  '
>  `---=========------=======-------------=-=-----=-===-======-------=--=---'
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> 
> 



Reply to: