aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sos/plugins/__init__.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index 7e865cdf..88c909f8 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -191,6 +191,18 @@ class Plugin(object):
replacements = 0
return replacements
+ def do_path_regex_sub(self, pathexp, regexp, subst):
+ '''Apply a regexp substituation to a set of files archived by
+ sos. The set of files to be substituted is generated by matching
+ collected file pathnames against pathexp which may be a regular
+ expression string or compiled re object. The portion of the file
+ to be replaced is specified via regexp and the replacement string
+ is passed in subst.'''
+ match = pathexp.match
+ file_list = [f for f in self.copied_files if match(f['srcpath'])]
+ for file in file_list:
+ self.do_file_sub(file['srcpath'], regexp, subst)
+
def do_regex_find_all(self, regex, fname):
return regex_findall(regex, fname)