[NCLUG] Find, grep and other pointy instruments
Mark Horning
rip6 at rip6.net
Fri Apr 20 18:28:09 MDT 2001
Michael Dwyer wrote:
>
> I'm looking for a way to do this:
>
> find / -print | grep "everything unless it is a directory which
> includes a specific file"
>
> Seeing as how regexp is a little too advanced to understand English,
> does anyone have any tools that do this? I could probably write
> something, but then I'd have to actually *think* and even *code*... and
> I'm hoping someone else has already seen this.
>
> For what it is worth, I expect it would be found in backup scripts.
> That's what I hope to use it for. I need a way to mark directories so
> I'm not backing up things that, well, don't need it. I can place
> directo --
>
> Hmmm...
>
> find / -print | grep DO-NOT-BACKUP | sed -e 's/DO-NOT-BACKUP//' >
> excludelist
>
> This might work. Anyone have any other ideas or have seen this done
> somehow?
>
find / -name 'DO-NOT-BACKUP' -print | sed -e 's/DO-NOT-BACKUP//' >
excludelist
If you have locate:
locate DO-NOT-BACKUP | sed -e 's/DO-NOT-BACKUP//' > excludelist
locate's advantage is that it has already 'found' all the
files you are looking for and stored them in a database.
--
Mark Horning
rip6 at rip6.net
More information about the NCLUG
mailing list