简体   繁体   中英

how to grep external txt file in bash script?

I would like to run a script that can be access in other terminals other then my own. like bash <(curl -s http://domain.com/scripts/hello.sh ) but I need this script to grep a txt file that is also located on that server for example domain.com/scripts/stuff.txt. What would be the best method?

Try:

curl -s http://domain.com/scripts/stuff.txt | grep "$Hi"

You can redirect the output to a local text file, like so:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM