def absent(src, line, regexp, encoding): """Delete lines with matching regex pattern Arguments: src: {str} -- The z/OS USS file or data set to modify. line: {str} -- The line to be deleted in the src. If line matches, regexp will be ignored. regexp: {str} -- The regular expression to look for in every line of the src. encoding: {str} -- Encoding of the src. Returns: str -- Information in JSON format. keys: cmd: {str} -- dsed shell command found: {int} -- Number of matching regex pattern changed: {bool} -- Indicates if the source was modified. """ return Datasets.lineinfile(src, line, regexp, encoding=encoding, state=False)
def present(src, line, regexp, ins_aft, ins_bef, encoding, first_match, backrefs): """Replace a line with the matching regex pattern Insert a line before/after the matching pattern Insert a line at BOF/EOF Arguments: src: {str} -- The z/OS USS file or data set to modify. line: {str} -- The line to insert/replace into the src. regexp: {str} -- The regular expression to look for in every line of the src. If regexp matches, ins_aft/ins_bef will be ignored. ins_aft: {str} -- Insert the line after matching '*regex*' pattern or EOF. choices: - EOF - '*regex*' ins_bef: {str} -- Insert the line before matching '*regex*' pattern or BOF. choices: - BOF - '*regex*' encoding: {str} -- Encoding of the src. first_match: {bool} -- Take the first matching regex pattern. backrefs: {bool} -- Back reference Returns: str -- Information in JSON format. keys: cmd: {str} -- dsed shell command found: {int} -- Number of matching regex pattern changed: {bool} -- Indicates if the source was modified. """ return Datasets.lineinfile(src, line, regexp, ins_aft, ins_bef, encoding, first_match, backrefs, state=True)