There are two things wrong with your attempt:
You pipe the
cat
ed output tosed
, so you are only changingstdout
.The right-hand-side of the pipe is run locally, not on the remote server since it is outside of your quoted string.
What you probably want is
ssh user@host 'sed -i "s/55555/00000/g" ~/path_of_original_file.txt'
where -i
means in-place (see man sed
).
Also note that /g
will change all occurrances of 55555
, not just the first/the one on line 5.
Since you are on Solaris and your sed
probably doesn't have -i
you need to use a temporary file (see also e.g. here).