Filtering tokens when you dont need to copy a file to a new location

I am trying to understand how I can go about replacing tokens in a file that needs to stay put. when I try something similar to the following code snippet, I end up with a blank file - all tokens and text gone.

task replacethesetokens(type: Copy) {
    from '/home/me/gradletest'
    into '/home/me/gradletest'
    include 'testfile'
    filter(ReplaceTokens, tokens: [FOO: "bar"])
}

Does anyone have a direction to point me in?