Friday, April 26, 2024
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 1224  / 3 Years ago, wed, may 19, 2021, 1:23:33

I want to know if it is possible to read files over HTTP like:



$ cat http://example.com/archive/myhouse.txt


Is it possible? And is there any extra or better ways to do it? Thanks!


More From » command-line

 Answers
0

"Instead of cat, which reads a file from the file-system, use wget -O- -q, which reads a document over HTTP and writes it to standard output:



for i in $(wget -O- -q http://localhost/1/downloads.txt)


(The -O... option means "write to the specified file", where - is standard output; the -q option means "quiet", and disables lots of logging that would otherwise go to standard error.)
"



Here's the original q/a:



https://stackoverflow.com/questions/8978261/how-can-i-cat-a-remote-file-to-read-the-
parameters-in-bash



Tried it myself and found that to read one specific file I did this:



wget -O- -q http://localhost/1/downloads.txt

[#26666] Thursday, May 20, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
gavgenerati

Total Points: 120
Total Questions: 126
Total Answers: 119

Location: Marshall Islands
Member since Wed, Feb 9, 2022
2 Years ago
gavgenerati questions
Wed, Jun 22, 22, 17:24, 2 Years ago
Fri, Jul 30, 21, 04:32, 3 Years ago
Fri, Jan 14, 22, 14:20, 2 Years ago
Tue, Jul 27, 21, 19:05, 3 Years ago
;