scp and append to a remote node

I have multiple nodes and combine the files with the same name into one single file. Is there a way to scp or something else and combine them?

I tried this, but not working....

/usr/bin/scp /usr/local/system/scripts/myout.txt >> ahcaxdbmil1c:/usr/local/system/scripts/myout.txt

Please advise.

If you have ssh keys set up:

/usr/bin/cat somefile | ssh remotenode  '/usr/bin/cat - >> /path/to/anotherfile'

Warning: Try this on junk files first. Or make backups of the real files first.

1 Like

Here is an alternative way with no pipe :

ssh root@ahcaxdbmil1c "cat >> /usr/local/system/scripts/myout.txt" < /usr/local/system/scripts/myout.txt
1 Like

Yes!!! They work perfectly!
Thank you so much.