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

Re: regular expression?



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  '
 `---=========------=======-------------=-=-----=-===-======-------=--=---'



Reply to: