> can do it.echo text > filetee can do it.echo test | tee file Can sed do it without using either of the above? Is it possible to save the output of a sed command to a file without using either > or tee?
Can sed save its output to a file?
sed;io redirection
tee and > can be used for data redirection because these are meant to be used for data redirection in linux. sed on the other hand is a stream editor. sed is not meant for data redirection as tee and > meant to be. However you can use conjunction of commands to do that.use tee or > with sedsed 's/Hello/Hi/g' file-name | tee fileorsed 's/Hello/Hi/g' file-name > fileuse sed with -i optionsed -i 's/Hello/Hi/g' file-namethe last one does not redirect, instead it will make changes in the file itself.