Append file
I hv a file want to scp to another server , but I don't want to overwrite the remote file , I want to append this file to the original file , can advise what can i do ? thx
|
Here is a way:
ssh target.machine 'F=$(mktemp);scp source.machine:sourcefile $F ; cat $F >> targetfile ;rm $F' Note: this will create the targetfile if it does not exist or append if it does. It is actually a scp being run on the target machine. Dave |
Here's another way using cat and ssh instead of scp:
cat localfile | ssh user@remoteserver "cat >> remotefile" Richard |
All times are GMT -5. The time now is 06:03 PM. |