Issue
I have a question
How can I cat filea.txt
and write to fileb.txt
with a shell script? Filea
and fileb
are different server Linux.
cat filea.txt >> fileb.txt
in other server
Many thanks!
Solution
cat filea.txt >> /tmp/fileb.txt
scp /tmp/fileb.txt [email protected]:~/fileb.txt
Just to let you know, ~/
is the home directory of that user. You'd need to replace the user and the ip, ofc.
You can also not paste into the home directory and do a full file path.
scp is really cool, check out its man page.
EDIT: I do see your trouble with the appending.
You can try to cat filea.txt | ssh [email protected] "cat >> fileb.txt"
This works because cat takes from stdin when no file is specified.
Answered By - Leif Messinger LOAF