Home
| Calendar
| Mail Lists
| List Archives
| Desktop SIG
| Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU |
On Thu, Oct 13, 2011 at 03:00:04PM -0400, David Kramer wrote: | PS: I did see one working example at | http://travelingfrontiers.wordpress.com/2010/08/22/how-to-add-colors-to-linux-command-line-output/ | sed ''/crit/s//$(printf "\033[31mCRITICAL\033[0m")/g'' | | However, it relies on the printf command, which means (1)launching another process and 2) not | using sed's buffers, so I can't have a series of sed operations in one command. I use something similar to this, also running an external command (echo). Here's an example, using the -e sed command argument function getinfo() { DEV="$1" WHAT="$2" REGEXP="s,.*${WHAT}:\([0-9.]\+\).*,\1,p" ifconfig ${DEV} | sed -n -e "$(echo ${REGEXP})" } AFAIR I went through the same issues and apparently you cannot directly pass variables to sed. If you feel thank you can do the same with (g)awk instead, you can pass variables to it.
BLU is a member of BostonUserGroups | |
We also thank MIT for the use of their facilities. |