Tell a Friend to Become a Follower!

Thursday, August 26, 2010

The Grunion and Tom Talk Shop

GRUNION:  What's up T?
TOM: Nothing.  How are you?

GRUNION:  I need to discuss something, but first I'll need your glasses to chew on.


TOM:  Mmmkay...


GRUNION:  I'm trying to do a search on an entire directory, finding all the instances of the text "applicationX" and replacing all instances with the text "applicationY".  I created this:   following> to find all instances and print the files that contain the search text. But now I don't know how to replace the text.

TOM:  Hmm.

GRUNION: So what gives?

TOM:  Well, the grep -il statement finds all instances of Hello in files ending in txt (i = ignore case, , l = only list the filename). The file names are passed to sed, which runs a regular expression to change all instances of Hello to Goodbye. Since sed doesn't overwrite a file, you should redirect the output to a temp file and then rename it back to the original file name.

GRUNION:  Sweet.  Can I use your computer to hack into Elmo.com?
TOM:  No.


GRUNION:   Dang.

1 comment:

Got something to say?