duplicate code and dont sed if the file doesnt exist