escape tokens in file name replacement

otherwise if file name contains "$ " somewhere then replacement fails