Hi
This can range from almost impossible to easy, depending on your source file (text), using ONLY shell script alone. Can you post and example text file and state what to remove?
Since you are on Linux, there are easier ways to achieve it, if the text file and filters are complex. İt can be a shell script still, but say, use python,php etc to make it easier thus cheaper. For example, I generally use php to create such scripts, and enclose it in a shell script so it can be run on console or cron easily.
Can you contact me on chat please?
Best regards and have a great day,
Baris