John Lewis John Lewis - 12 days ago 5
Bash Question

How can I get curl -w output (invoked by xargs) onto separate lines?

I am trying to split the lines that I get from the following command but it's not being split at new line. How to do it?

seq 0 1 5000 | xargs -n 5 -I{} -P 5 -- curl -s -o /dev/null -w "%{http_code} %{url_effective}" "http://somewebsite.com/{}.txt" >> result.txt

Answer

Put a \n in your format string if you want each result to be on its own line:

-w '%{http_code} %{url_effective}\n'
Comments