views:

81

answers:

2

I want to be able to save a data stream which i am returning using the curl command. I have tried using the cat command, and piping it the curl command, however i'm doing it wrong. The code im currently using is:

cat > file.txt | curl http://datastream.com/data

Any help would be appreciated.

+2  A: 

Try:

curl http://datastream.com/data > output_file.txt
Jim Lewis
You can also use `curl -o output_file.txt http://datastream.com/data`.
zneak
Brilliant that worked! Silly me over complicating things, should have read the man page for curl :p Thanks :D
jonhurlock
+2  A: 

So, you are using 'curl' to collect data, and want to capture its output?

curl http://example.com/data > file.txt

Or, indeed (from the man page):

curl -o file.txt http://example.com/data
Jonathan Leffler
Cheers :D both worked. Should have read the man for curl. Thanks alot for your help :D
jonhurlock