You don't need either of those two programs. To edit a text file just completely rewrite it. Open the original for reading, open a new file for writing, in a loop read a line from the original file, edit it as necessary, then rewrite it to the output file (or just ignore it if you want to delete it). When done, close both files, delete the original file, then finally rename the new file with the same name as the original file.
There are no standard C functions that perform regular expressions. If you were using c++ then you could get such a library from boost