Hello Bill! > I'm struggling with the PCRE ignore patterns. I'd recomment using the shell patterns, except if there's a good reason not to.
> I found > http://perldoc.perl.org/perlre.html to explain the patterns and pcregrep > from http://linux.die.net/man/1/pcregrep to test them, but I'm not getting > the results I'm expecting. I don't know if that is a good tool to use or > not. "pcregrep searches files for character patterns, in the same way as other grep commands do, but it uses the PCRE regular expression library to support" This looks in *files*, not at their names. > # pcregrep -drecurse ./*.bak / > This command looked inside of every file instead of just the directory > listings. Yes. > So, in the root, I did > # find / -name '*' > /home/listing2.txt > That gave me a list of all the files, with complete paths. Correct. > So now I use the command > # pcregrep ./*.bak listing2.txt > That command gave me all the files with "bak" anywhere in the name, but > only > two directories or deeper: > /var/backups/gshadow.bak > /usr/share/app-install/icons/gnomebaker.xpm > ... > > Not > /boot/initrd.img-2.6.22-14-generic.bak In PCRE the "." is a wildcard - it means *any* character, and for your full paths it would match the "/" at the start. "/*" means 0 or any number of "/"; the ".bak" means "any character, followed by 'bak'". So that pattern would match a file named "XXbak", too. Use shell patterns; PCRE is just a last resort. > I didn't want "gnomebaker" excluded at this time, so I used the command > # pcregrep /*[.]bak listing2.txt > This gave me only the files ending with ".bak", ".bakup" and so forth. > This > is good. PCRE patterns are not automatically anchored at the end; and pcregrep doesn't anchor anywhere, until you say to. So the string *after* "bak" is completely ignored. > So a couple questions. > 1) Every example provided with fsvs starts with ./ > Is there something magical about that in fsvs? > Or do you want to start two directories down? No. Internally FSVS uses "." for the working copy root, and for consistency builds the paths up from there - so a file "xx" in the working copy root would have an internal name of "./xx". For the ignore patterns the "./" serves as a validation for input. > 2) The docs have the pattern ./ **.bak > That matches everything in pcregrep. > How does that pattern work? Because FSVS translates that pattern, for use as a shell-pattern. The space should be removed - that's only there because of the C comment syntax. As a shell pattern: ./ as pattern recognition ** for any directory depth .bak that string must be at the end of the path. http://fsvs.tigris.org/source/browse/*checkout*/fsvs/trunk/www/doxygen/html/group__ignpat.html > Sorry for the long post. NP. Regards, Phil -- Versioning your /etc, /home or even your whole installation? Try fsvs (fsvs.tigris.org)! --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
