我怎么能使用grep,并ls在FTP客户端...
我的意思是,如果我想找到一些我可以使用的特定文件:
ls -l | grep pattern
Run Code Online (Sandbox Code Playgroud)
使用通常的Unix命令行交互式ftp,一种方法是:
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> dir . foobar
output to local-file: foobar [anpqy?]? y
500 Unknown command
227 Entering Passive Mode (62,149,140,15,195,159)
150 Accepted data connection
11966 5.26 KB/s
226-Options: -a -l
226 156 matches total
ftp> !grep con foobar
-rwxr-xr-x 1 11050207 users 911007 Sep 13 2007 accu_pyconc.pdf
-rwxr-xr-x 1 11050207 users 9805405 Mar 25 2009 pycon_abst.pdf
Run Code Online (Sandbox Code Playgroud)
即,首先将dir结果放入本地文件,然后在本地运行grep.顺便说一句,这可以让你在支付一次dir数据传输后运行多个greps ;-).