Symlink notifyd.py to osd_server.py for backward compatibility
[grml-scripts.git] / usr_bin / hgrep.sh
1 #!/bin/zsh
2 # Filename:      hgrep.sh
3 # Purpose:       highlight grep
4 # Authors:       Oliver Kiddle (<URL:http://www.zsh.org/mla/workers/2001/msg00390.html>)
5 # Bug-Reports:   see http://grml.org/bugs/
6 # License:       This file is licensed under the GPL v2.
7 ################################################################################
8
9 if (( ! $# )); then
10   echo "Usage: $0:t [-e pattern...] [file...]" >&2
11   return 1
12 fi
13
14 local -a regex
15 local htext=`echotc so` ntext=`echotc se`
16
17 while [[ "$1" = -e ]]; do
18   regex=( $regex "$2" )
19   shift 2
20 done
21
22 if (( ! $#regex )); then
23   regex=( "$1" )
24   shift
25 fi
26
27 regex=( "-e
28 s/${^regex[@]}/$htext&$ntext/g" )
29 sed ${(Ff)regex[@]} "$@"
30
31 ## END OF FILE #################################################################