code: protected void searchAndReplace(List<CmsResource> resources) {
  
          // the file counter
          int counter = 0;
          int resCount = resources.size();
          I_CmsReport report = getReport();
          // iterate over the files in the selected path
          for (CmsResource resource : resources) {
  
              try {
  
                  // get the content
                  CmsFile file = getCms().readFile(resource);
                  byte[] contents = file.getContents();
  
                  // report the current resource
                  ++counter;
                  report(report, counter, resCount, resource);
  
                  // search and replace
                  byte[] result = null;
                  boolean xpath = false;
                  if ((CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_settings.getXpath())
                      || m_settings.isOnlyContentValues()) && CmsResourceTypeXmlContent.isXmlContent(resource)) {
                      xpath = true;
                  }
                  if (!xpath) {
                      result = replaceInContent(file, contents);
                  } else {
                      result = replaceInXml(file);
                  }
  
                  if ((result != null) && (contents != null) && !contents.equals(result)) {
                      // rewrite the content
                      writeContent(file, result);
                  } else {
                      getReport().println();
                  }
  
              } catch (Exception e) {
                  report.print(
                      org.opencms.report.Messages.get().container(Messages.RPT_SOURCESEARCH_COULD_NOT_READ_FILE_0),
                      I_CmsReport.FORMAT_ERROR);
                  report.addError(e);
                  report.println(
                      org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_FAILED_0),
                      I_CmsReport.FORMAT_ERROR);
                  m_errorSearch += 1;
                  LOG.error(
                      org.opencms.report.Messages.get().container(Messages.RPT_SOURCESEARCH_COULD_NOT_READ_FILE_0),
                      e);
                  continue;
              }
          }
  
          // report results
          reportResults(resources.size());
      }
docs: Search the resources.<p>
  
  @param resources the relevant resources