This article talks about some tips, but the following caught my attention:
- using grep in color aware mode: the idea is to display all the text, but highlight what we want in a different color, the first one here will match everything but will not color anything because beginning of line is just an abstract placeholder. The rest of the matches will be highlighted.
- cat a.txt | grep ‘^|pattern1|pattern2’
- splitting a line into set of words (separated by spaces):
- fmt -1 < file.txt will do that