Just another point perhaps worth mentioning: Who has control over what is put in each text file?
I.e. if you have users on your system that can create these files, then you have a potential security risk - it would be worth untainting or checking the files before running any system calls on it. Just a warning!