Viewing 1 to 6 of 6 items
Archive | grep RSS feed for this section

Coloring Grep to easier research

his is an example of a search with grepwith a coloured output: To get this result open a terminal and use your favourite editor to change the file .bashrc in your home directoy, in this example I’ll use vim $ vim ~/.bashrc And add these 2 lines: alias grep=”grep –color=auto” export GREP_COLORS=’0;31′ Save and try  Full Article…

0

grep with color output

grep is capable of color-highlighting the matched string in its output. But, by default, that option is turned off. $ grep abc a_file.txt abcdef There are 3 color options available to you: –color=auto –color=always –color=never With color=always, it colors the matched string. $ grep –color=always abc a_file.txt abcdef Quite often, you want to page through  Full Article…

0

color grep and ls on Linux

Ever wondered why grep shows the matched text/string in colour where as its not the same on other systems? or why ls on you system shows different colour for different file-types while the output on your buddy’s desktop, running some other flavour of linux, is so lifeless(without colours)? Well, thats because of the magic of  Full Article…

0

Combine find and grep for a complex search

find /srv/www/*/htdocs/system/application/ -name “*.php” -exec grep “debug (” {} \; -print This should recursively search the folders under application for files with .php extension and pass them to grep. An optimization on this would be to execute: find /srv/www/*/htdocs/system/application/ -name “*.php” -print0 | xargs -0 grep -H “debug (” find is not even needed for  Full Article…

0

grep

grep grep is an acronym that stands for “Global Regular Expressions Print”. grep is a program which scans a specified file or files line by line, returning lines that contain a pattern. A pattern is an expression that specifies a set of strings by interpreting characters as meta-characters. For example the asterisk meta character (*)  Full Article…

0

Excluding grep from process list

ps aux | grep daemon_name | awk “{ print $2 }” grep’s -v switch reverses the result, excluding it from the queue. So make it like: ps aux | grep daemon_name | grep -v grep | awk “{ print $2 }” Upd. You can also use -C switch to specify command name like so: ps -C daemon_name -o pid=  Full Article…

0