Skip to main content
added 5 characters in body
Source Link
Hunter.S.Thompson
  • 9.2k
  • 7
  • 28
  • 41

aA sed version, works on both bash and ash.

#highlight hsed(){ local pattern="$1" shift local r=`echo -e '\e'[31m` local c=`echo -e '\e'[0m` sed "s:${pattern//:/\:}:$r\0$c:g" "$@" } 

a sed version, works on bash and ash.

#highlight hsed(){ local pattern="$1" shift local r=`echo -e '\e'[31m` local c=`echo -e '\e'[0m` sed "s:${pattern//:/\:}:$r\0$c:g" "$@" } 

A sed version, works on both bash and ash.

#highlight hsed(){ local pattern="$1" shift local r=`echo -e '\e'[31m` local c=`echo -e '\e'[0m` sed "s:${pattern//:/\:}:$r\0$c:g" "$@" } 
Source Link
yurenchen
  • 320
  • 2
  • 12

a sed version, works on bash and ash.

#highlight hsed(){ local pattern="$1" shift local r=`echo -e '\e'[31m` local c=`echo -e '\e'[0m` sed "s:${pattern//:/\:}:$r\0$c:g" "$@" }