Welcome to the forum.
Assuming bash/shell scripting, see here for general file reading techniques:
How can I read a file (data stream, variable) line-by-line (and/or field-by-field)?
http://mywiki.wooledge.org/BashFAQ/001
If you want more detailed help, then you'll have to provide a more detailed description of what you are doing. Describe
exactly what your goals are, what the input is like, and what you want the output to be, and what you have tried to do so far. Post actual code and examples if possible.
Please read
How To Ask Questions The Smart Way, and then post back.