[英]how to grep external txt file in bash script?
我想运行一个脚本,该脚本可以在除我自己以外的其他终端中访问。 像bash <(curl -s http://domain.com/scripts/hello.sh ),但我需要此脚本来grep一个也位于该服务器上的txt文件,例如domain.com/scripts/stuff.txt。 最好的方法是什么?
尝试:
curl -s http://domain.com/scripts/stuff.txt | grep "$Hi"
您可以将输出重定向到本地文本文件,如下所示:
curl -s http://domain.com/scripts/stuff.txt | grep "$Hi" > stuff_that_starts_with_hi.txt
下载一个文本文件,并将其传输到grep中:
curl http://domain.com/scripts/stuff.txt | grep foo
您也可以使用wget
wget -qO - http://domain.com/scripts/stuff.txt | grep dat
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.