1 browser linux terminal robots.txt
我可以在终端中运行一个程序,它会吐出一个网页的输出吗?基本上我想将其输出(robots.txt)从网页重定向到txt文件.
Wget有这个选项,等等; 这会将页面输出到标准输出:
wget -O - http://www.example.com/robots.txt
Run Code Online (Sandbox Code Playgroud)
这将写入您指定的文件:
wget -O /whatever/output/file/you/put/here.txt http://www.example.com/robots.txt
Run Code Online (Sandbox Code Playgroud)
如果要将多个命令附加到一个文件,可以使用shell的重定向功能.这会将页面内容附加到指定文件的末尾,并保留其先前的内容:
wget -O - http://www.example.com/robots.txt >> /home/piskvor/yourfile.txt
Run Code Online (Sandbox Code Playgroud)