Help with curl piped to awk

Greetings!!

am trying to retrieve a particular section from the url as in url.txt..

aim is to get the 83.8 MB as output, but somehow this is not happening!, please suggest what might be wrong.. attached is the screenshot and text file of the page source.

Best Regards,
Vinu

In what way is it "not happening"? What happens?

Post what you actually did in code tags.

Modify your awk like below:-

curl -iSA "Mozilla/5.001" http://uptobox.com/hweq1l5vgt5r |awk -F"[)(]" ' { print $2  } '

Greetings!

when the command is run, output is as in attachment..

Best Regards.
Vinu

Correction:-

curl -iSA "Mozilla/5.001" http://uptobox.com/hweq1l5vgt5r |grep "http://uptobox.com/hweq1l5vgt5r" | awk -F"[)(]" ' { print $2  } '

Hope it helps.

Yes:b: Bipinajith!!

now the 83.8 MB comes as output:):slight_smile:

Also,could please let know how to get the original url which was read beside the 83.8 MB after a tab space like..

83.8 MB url_which_was_read

Best Regards,
Vinu

Add the highlighted:-

awk -F"[)(]" ' { print $2 " " $1 } '

oops, there is no output when redirected to a file as earlier..

Best Regards,
Vinu

I don't understand!

You confirmed that you got 83.5 MB as output, you just have to modify the same command by printing first parameter ($1) which is the URL.

Hi,

yes.. the command is working..though not on that earlier url which has now expired and the page does not have the 83.5 mb on it..

tried on another url as in out6.txt.. looks like there is some unwanted data..could you help in filtering these..

Best Regards,
Vinu

Got it. Looks like the best option is to pass the URL to awk to print it beside the extracted file size value:-

curl -iSA "Mozilla/5.001" http://hipfile.com/1b0kksnik2pn |grep "http://hipfile.com/1b0kksnik2pn" | awk -F"[)(]" ' { print $2 " http://hipfile.com/1b0kksnik2pn" } '

I hope it helps.

Yes!:b:

that was the best method at least presently..:slight_smile:

Also, Bipinajith .. could you help further in other problematic urls..? in your free time ofcourse ..

just got one more:eek: as in url2.txt.. where 83.82 MB is to be got from..

Best Regards,
Vinu

Is it really necessary to attach such small files? Can't you just paste the contents between code tags?

My downloads folder already has enough stuff in it :wink:

Fine Scott.. oops!! had forgotten about the 5 posts requirement to post urls..:wall:

I wasn't trying to be awkward. Just put the stuff between code tags...

Simple, really...

<alt="" class="whitelink" style="width: 100%; height: 100%;" /></a></div></div>
		<div style="position: absolute; left: 120px; top: 112px;">
			<img src="share/images/dl_first_tacho.gif" alt="" /></div>
		<div style="position: absolute; left: 393px; top: 112px;">
			<img src="share/images/dl_first_tacho2.gif" alt="" /></div>
		<div class="dl_first_file_download">
			Download File</div>
		<div class="dl_first_filename">
			Diya_Aur_Baati_Hum_30th_October_2012_part2.avi<span style="color: #8d8d8d;">, 83.82 MB</span></div>
		<div class="dl_first_duration1">
			Estimated Download Time at 16 MB/s</div>
		<div class="dl_first_duration2">
			Estimated Download Time using the free download</div>
		<div class="dl_first_time1">
			<span class="dl_first_orange">7</span> Second</div>
		<div class="dl_first_time2">
			over <span class="dl_first_orange">15</span> Minutes</div>
	</div>

...instead of uploading 900-byte attachments.