Thread: Just playing
View Single Post
Old Aug 28th, 2006, 5:51 AM   #1
Pimp Daddy
Programmer
 
Join Date: Aug 2004
Location: Wherever the beautiful women are.
Posts: 30
Rep Power: 0 Pimp Daddy is on a distinguished road
Send a message via MSN to Pimp Daddy Send a message via Skype™ to Pimp Daddy
Just playing

Although I've been using Linux for a while (in various forms - such as Slackware and Cygwin), I never got around to learning the likes of grep, sed and awk. That's what I've been doing over the past few days and today I noticed something with sed. I type the following:

$ sed -e '/mom/s/world/hull/g' h.txt

Naturally, it replaces 'world' with 'hull' and prints the result out on the screen. However, when I try overwriting what's in the file by doing this:

$ sed -e '/mom/s/world/hull/g' h.txt > h.txt

it just wipes the file. What do I have to do to overwrite the contents of a file?
__________________
David Morris BSc.(Hons), MBCS
Qualified Computer Engineer
Administrator (SEED Software)
Pimp Daddy is offline   Reply With Quote