Tips tagged grep


9

Tip #215   Calendar with today colored [handle single digit dates]

If your version of grep supports coloring matches, you can use the following to give a calendar with the current date colored:

Read more »

29

Tip #192   Print a random shell-fu tip

Print a random shell-fu tip:
Read more »

14

Tip #189   Remove every file but one

It's easy to remove (or copy, move etc.) all files that match a given criteria, but harder to move all but ones excluded by a criteria.

To do this we can combine grep's -v option with Unix command substitution:

Read more »

24

Tip #22   Grepping for processes

Grepping for a process will return the grep command, this can be avoided by adding '| grep -v grep' to a command or easier in some cases altering the regular expression by adding brackets around a character.

Read more »

183

Tip #21  

Place a filename at the beginning of the line to make it easier to edit the search at the end of the command.

Read more »

4

Tip #48   Check low space

Mail somebody about space running low in some path (ksh, bash):

Read more »

6

Tip #64   Find occurrences of a string in a large code base without firing

example, look for all the TODO and HACK strings I left in large java project and show a bit of context before and after using the -C switch of grep.

Read more »

3

Tip #87  

Perform a recursive grep of the Solaris /etc directory, bypassing those nasty sockets Sun keeps in there:
Read more »

9

Tip #88   a better cut

use `grep -o` to select only the pattern matched rather than the whole line:

Read more »