pass the file in second if replace is a function