linux - SCP first line of a file to another system -


i think should possible use combination of scp command , head command copy first line of file remote system, haven't been able come right command make happen.

given scp command this:

scp /shared/myfolder/myfile.txt myuser@myserver:/newlocation/myotherfolder/myfile.txt 

i'd send first line of myfile.txt remote system. use command first:

head -1 myfile.txt >> myfile2.txt 

and scp myfile2.txt, helpful have in single command.

scp doesn't read stdin or work bash process substitution, can try hacks like:

head -1 myfile.txt | ssh  myuser@myserver "cat > /shared/myfolder/myfile.txt" 

Comments

Popular posts from this blog

html - How can i make an element from a bottom stacking context stays in front of another higher stacking context? -

python - TypeError: start must be a integer -

html - href attribute breaking an element -