Your question is a bit vague. All I can suggest is that you
use
open,
print and
flock. But
how, and what else, I cannot determine from your description.
It all depends on what's in that text file, what needs to be
kept and what needs to be used before removed.
-- Abigail