write and read trim files