Use a regular expression to capture each part of the filename into a remembered group. Then use the parts you want to keep.
Input is your filename (can be a variable). The regex uses parenthesis for remembered groups left to right and inside are 0 or more of any characters. So it can be read from left to right as remember a group of 0 or more of any characters followed by an underscore, followed by a 2nd group of the same, a third and a fourth but followed by a literal dot and the text "txt". Replace all that with the first remembered group (referenced by $1), an underscore, the 3rd remembered group, then the text ".pgp".
{REGEX(Replace|aaaaa_bbbbb_ccccc_dddd.txt|(.*)_(.*)_(.*)_(.*)\.txt|$1_$3.pgp)}
Oh to get the file name from a variable you need to know how you are getting the file name in the first place. A trigger that started the job? Previous task's STDOUT? Listing files in a folder?
Edited by user
2018-10-09T21:30:06Z
|
Reason: Not specified