Thread: sed and hex
View Single Post
  #3   (View Single Post)  
Old 10th July 2008
ocicat ocicat is offline
Join Date: Apr 2008
Posts: 3,300

Originally Posted by na5m View Post
I'd like to hyphenate the word "gratefull" using sed so that "gratefull" becomes "grate-full".
It is unclear as to whether you are expecting the original file to be overwritten. ie.
$ sysctl kern.version
kern.version=OpenBSD 4.3-current (GENERIC) #0: Wed Jun  4 12:43:45 PDT 2008

$ cat file
first line gratefull
second gratefull line
third line
gratefull fourth line
$ sed 's/gratefull/grate-full/' file > file1                                                                             
$ cat file1
first line grate-full
second grate-full line
third line
grate-full fourth line
Reply With Quote