If you want to substitute strings via sed, it is very easy:
Any other ideas? What abaout using the dollar (money always helps ;-):
# echo 'hello world!' |sed 's/hello/it is a cool/'But what if you want to use a strong quote inside the substitution?
it is a cool world!
# echo 'hello world!' |sed 's/hello/it's a cool/'gets interpreted from the shell and nothing happens. Next try: Escape the strong quote with a backslash:
# echo 'hello world!' |sed 's/hello/it\'s a cool/'Does not work...
Any other ideas? What abaout using the dollar (money always helps ;-):
# echo 'hello world!' |sed $'s/hello/it\'s a cool/'
it's a cool world!
what about:
ReplyDeleteecho 'hello world!' |sed "s/hello/it's a cool/"
$echo 'hello world'|sed "s/hello/it's a cool/"
ReplyDeleteit's a cool world
$
;-)
cool, didn't know that money also helps here !
ReplyDelete$ echo 'hello world!' |sed "s/hello/it's a cool/"
it's a cool world!