Available for: Content Management Server
Task: The procedure determines from a list of CMS files the ones that contain the given string in a particular field. Additionally, the state of the files to be found can be restricted.
Syntax:
grep expression objects [attribute] [args]
Function parameters:
expression
: the regular expression to apply
objects
: the list of CMS files to be searched
attribute
: the field to be searched. This
parameter is optional. The default is blob
args
: optional specification of
additional restrictions. args
can be:
-states state
: This restricts the results set to CMS files of a particular
state or a selection of states. state
can be one of:
edited
, committed
, released
,
archived
.all
(the default) stands for any state.active
stands for any state except
archived
.Return value if successful: for each file found its
path, details about the location where the search term matched, and
part of the text containing the search term (string). The location is
specified by means of the file ID (o
), the version ID
(c
), and the line number (l
). See below for
an example.
Necessary permissions: The user must have the read permission for the files that were found.
Example:
CM>grep "modifyvar" [obj where condition {objType is template}] /mastertemplate (o:2011,c:2015,l:4) <npsobj modifyvar="set" varname="contentTypeAndCharset">text/html; charset=<npsobj insertvalue="var" name="exportCharset" /></npsobj>