grep |
Search and optionally replace regexps in objects contents
Accepts many options:
--recurse recursive search --maxdepth n descend at most n levels --type metatype search only objects of meta type xxx --owner xxxx objects owned by user xxxx --newer /other/object objects modified more recently than other --older /other/object objects modified less recently than other --mmin n objects modified less than n minutes ago --mtime n objects modified less than n days ago --properties search in properties too --replace xxxx replaces each occurence of the pattern with the string xxx. --invert invert the search: objects that don't match the regexp are selected --ignorecase ignore case: this is just for convenience since it's always possible to use a pattern which explicitly asks for ignoring case.
e.g.:
grep --recurse --ignorecase ¨^word" *_html
this one will search recursively for each document which id ends in "_html" and which has "word" at the beginning of a line, ignoring differences between UPPER and lower case.
grep --properties --type "DTML*" --type Folder somestring *
This one will search for "somestring" in all objects which meta type is Folder or begins with "DTML" and their properties.
The string to search for and the optionally replacing string could be any regular expression defined by the standard re python module.
Hint: You may use multiple --type or --owner arguments and each can contain wildcards.
WARNING: don't forget to enclose your regexps between single or double quotes or else some regexps won't work as expected.
Caveats: If not given the --properties option, only searches in the document_src() and title attributes of objects that have a document_src attribute (if not clear email me).
|
|