A Couple of Command Line beauties

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
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s