You are not logged in.
Pages: 1
Hi again!
Is it possible to get filesize using the wget command?
wget -O- http://cuddlewagon.org/somefile.txt | du -b THEFILELast edited by svanberg (2009-07-29 20:56:32)
Offline
du -b won't work, try wc -c
Offline
Thanks for your help!
wget -O- http://cuddlewagon.org/somefile.txt | wc -cLast edited by svanberg (2009-07-26 23:17:08)
Offline
This isn't the ideal way of doing it, since it requires you to download the entire file. It is better to just get it from the response header. Not entirely sure how you do it in wget, but with curl you can do
curl -sI $url | grep Content-Length | cut -d ' ' -f 2Offline
When running
wget --spider http://cuddlewagon.org/somefile.txt 2>&1 | grep LengthWill give me:
Length: 543 [text/plain]Can i use awk to grep only numbers? These numbers will grow in so the regular expression must take value from 1 and above.
Last edited by svanberg (2009-07-29 09:39:43)
Offline
I solved this by using:
wget --spider http://cuddlewagon.org/somefile.txt 2>&1 | grep Length | awk '{print $2}'Gives me:
543Offline
Pages: 1