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

Quote:
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.
Code:
$ sysctl kern.version
kern.version=OpenBSD 4.3-current (GENERIC) #0: Wed Jun  4 12:43:45 PDT 2008
    me@mymachine:/usr/src/sys/arch/i386/compile/GENERIC

$ 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