You're replying to a comment by AskApache.

December 13, 2009, 14:11

I'm having to open like 8 pages on your site to get your sed tips.. It'd be much easier for people if you created a master sed jump off point.

I feel the same way about sed as you, modifying streams mid-stream is just freaking awesome.

Check this out:

G=$'\33[H\33[2J'
A=$'\a'

G will reset and clear the screen, A will cause a bell, but only if they are output to the tty.

Using sed I can tail a log file like a php_error.log file and when sed sees a special keyword appear in the output from tail it replaces it with G or A.

tail -f php_error.log | sed -u -e "s/AATPUTCLS/${G}/g"

And in my php file I might add

error_log('AATPUTCLS');

which would send that to the php_error.log and if it is being output via tail then sed resets the screen making it easy to focus in on code segments.

I hope you have some cool stuff on sed.. it's one tough cookie to figure out, but soo worth it. I use it alot in my various functions for my bash_profile.

Reply To This Comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the word "sandbox_13": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.