help: unix gurus ... sed command

LordSnailz

Diamond Member
Nov 2, 1999
4,821
0
0
hey guys, need a big help here ... been racking my brain over this stupid sed command ...

I have a file with a line that reads -
apple=red

I want to search and replace every instance of that to
kiwi=green
grape=purple

but I keep on getting it to change to kiwi=green\ngrape=purple. For some reason I can't add the carriage return in the sed command.

This is what I've tried --> sed -e "s?apple=red?kiwi=green/\ngrap=purple?g"

any suggestions, is it doable in sed? any help is appreciated, TIA!
 

Hector13

Golden Member
Apr 4, 2000
1,694
0
0
is this in windows? perhaps you need a \r in the file as well?

where do you see the "\n"s? in emacs or some other editor?
 

LordSnailz

Diamond Member
Nov 2, 1999
4,821
0
0
this is in unix ... using vi ...

is it true that older version of sed won't let you do it? argh this is driving me insane