Groovy web console

subscribe to the feed Subscribe
to this
site

sure

Published 1 month ago by FreeBDSM
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def call(String nodeLabel, String filePath, List replacements) {
    node(nodeLabel) {
        println("Replacing strings in file: '" + filePath + "'")
        replacements.each{
             it.each{
                needle, replacement -> println("Replacing '" + needle + "' with '" + replacement + "'")
            }
        }
    }
}

call(
    'linux',
    '/tmp/bullshit.txt',
    [
        [
            needle: 'tits',
            replacement: 'tats',
        ],
        [
            needle: 'beeps',
            replacement: 'boops',
        ],
    ]
)
 
return