Find and replace text (patterns) within a text file in terminal