My job often requires me to work with long files and I often reach for emacs to do my text editing.

Many times I'd like to write functions that work on a line by line basis of a text file.What is the process to break apart a text buffer such that the lines can be stored in an elisp list worked upon and pushed back into the buffer in place of the old lines? I'm currently writing a Common Lisp tool to do something similar but would like to duplicate the effort in elisp.

I suppose sometimes a list of the lines is desirable (sorting and working with the lines as a data set)and other times just modifying line by line is handy (applying transformations to each line)