[Ilugc] .a-tip-a-day. (grep - find lines matching pattern)
- From: steve@xxxxxxxxxxxx (steve)
- Date: Mon Nov 9 15:39:40 2009
On 11/09/2009 03:05 PM, Noorul Islam wrote:
On Mon, Nov 9, 2009 at 12:04 PM, Girish Venkatachalam
<girishvenkatachalam@xxxxxxxxx> wrote:
[...snip...]
Anyway the above is not the tip.
$ grep --color girish /etc/passwd
shows the matching lines with the keyword in color.
Note: If you pipe output to another program, coloring is gone.
Eg:- $ grep --color girish /etc/passwd | less
...unless you really work hard for it ...
$ grep --color=always girish /etc/passwd | less
...but of course less does not know yet that you like being colorful, so ...
$ grep --color=always girish /etc/passwd | less -R
When you get tired of all that typing, creating an 'alias' helps:
$ alias grep="grep --color=always"
$ alias less="less -R"
$ grep girish /etc/passwd | less
cheers,
- steve
--
random non tech spiel:
http://lonetwin.blogspot.com/
tech randomness:
http://lonehacks.blogspot.com/
what i'm stumbling into:
http://lonetwin.stumbleupon.com/
Other related posts: