OT: Regex question

Mark T. Valites yellowdog-general@lists.terrasoftsolutions.com
Fri May 3 16:41:01 2002


Don't use positive pattern matching here.  Use a negative character class.
[a-z]* would miss on dirs that start with "."s or digits or funky
characters.

tar cvf output_file.tar/path/to/[^A-Z]*

will take care of everything but the dir you want to skip and .files
The "^" means not.

To get a little fancier, try invoking command substitution to do it.

tar cvf output_file.tar `ls -lda [^A-Z]* | grep -v /path/to/file/to/skip`

Using `stuff` causes your shell to expand whatever is in the backticks
(called command subsitution) and feed it back to the shell.


On Fri, 3 May 2002, Robert Serphillips wrote:

> Date: Fri, 3 May 2002 17:10:22 +0000
> From: Robert Serphillips <rserphillips@austin.rr.com>
> Reply-To: yellowdog-general@lists.terrasoftsolutions.com
> To: yellowdog-general@lists.terrasoftsolutions.com
> Subject: Re: OT: Regex question
>
> try using the --exclude switch to omit houseofbig.com
>
> look under the man pages.
>
> something to this effect
> tar -czvf backup.tar.gz /path/to/[a-z]* --exclude /path/to/houseofbig.com
>
> this won't include any hidden file.
>
> -Rob
>
> On Fri, 3 May 2002 13:01:45 -0500
> Gawain <lists0501@guitar.net> wrote:
>
> > I want to eliminate a directory from a nightly backup script. Being a
> > bit of a regex newbie I'm scratching my head.
> >
> > Here's what I've got so far:
> >
> > tar -czf /path/to/[a-z]*
> >
> > I'd like to keep that rule (omitting directories beginning with a
> > capital) and also omit a directory named "houseofbig.com". How would
> > I do this?
> >
> > Thanks in advance for your help.
> >
> > Gawain
> > _______________________________________________
> > yellowdog-general mailing list
> > yellowdog-general@lists.terrasoftsolutions.com
> > http://lists.terrasoftsolutions.com/mailman/listinfo/yellowdog-general
> _______________________________________________
> yellowdog-general mailing list
> yellowdog-general@lists.terrasoftsolutions.com
> http://lists.terrasoftsolutions.com/mailman/listinfo/yellowdog-general
>

>--))> >--))>
Mark T. Valites
Unix Systems Analyst
1 College Circle - 124b1 South Hall
SUNY Geneseo
Geneseo, NY 14454
585-245-5577
585-259-3471 (Cell)