For SSH, what you can do is run the command non-interactive on the remote system:
ssh hostname "head /path/to/file"
This allows allows you to redirect the output into process on your local machine:
ssh hostname "cat /path/to/file" | head
The head
here is executed on your local machine.
You can also take local output and redirect it into an SSH session:
cat /local/file | ssh hostname "head > /remote/file"
This would take the content of your local file, pipe it through the SSH connection into a remotely running head, and write the output of head to a file on the server.
To access HTTP (and HTTPS) files and further process them locally the tool of choice is typically curl
:
curl http://domain.com/file.html > local-file
Here curl
is run locally and fetches the HTML file for you to work with.
It does not allow you to change the remote files though, as this is not a feature of the HTTP protocol.