I want to read first n lines of a huge file which resides at a different server. I was using scp to copy the file:
sshpass -p $password scp $username@$server:$path_to_file "$content_file"
you can use the following command to output remote result to local.
ssh hostA head srcfile > destfile
or use the following to output local output to remote.
ssh hostA 'head > destfile' < srcfile