回答:
シンボルを1つだけ逃した=)
ssh user@socket command < /path/to/file/on/local/machine
scp以前にそれをコピーする必要があります。
/dev/stdinまたはを指定してみてください-。動作する場合と動作しない場合/dev/stdinがあります(ファイルですが、検索は失敗します)
コマンドに関係なく機能する1つの方法は、リモートファイルシステムを介してリモートマシンでファイルを使用可能にすることです。SSH接続があるため:
# What if remote command can only take a file argument and not read from stdin? (1_CR)
ssh user@socket command < /path/to/file/on/local/machine
...
cat test.file | ssh user@machine 'bash -c "wc -l <(cat -)"' # 1_CR
代わるものとしてbash、プロセス置換<(cat -)または< <(xargs -0 -n 1000 cat)あなただけ使用することができます(下記参照)xargsとcatに指定されたファイルの内容をパイプにwc -l(より移植されています)。
# Assuming that test.file contains file paths each delimited by an ASCII NUL character \0
# and that we are to count all those lines in all those files (provided by test.file).
#find . -type f -print0 > test.file
# test with repeated line count of ~/.bash_history file
for n in {1..1000}; do printf '%s\000' "${HOME}/.bash_history"; done > test.file
# xargs & cat
ssh localhost 'export LC_ALL=C; xargs -0 -n 1000 cat | wc -l' <test.file
# Bash process substitution
cat test.file | ssh localhost 'bash -c "export LC_ALL=C; wc -l < <(xargs -0 -n 1000 cat)"'