Cookie Notice

As far as I know, and as far as I remember, nothing in this page does anything with Cookies.

2009/10/29

My first Perl one-liner


jacoby@oz:~$ ls -l *iso | perl -E 'while (<STDIN>) { $x=(split m{\s+}mx , $_)[4] ; say int $x * 100 / 723488768 , "% done" } '

I'm downloading Ubuntu 9.10 via FTP. I know the final size. Via ls I know the current file size. if a/b = y/100, where a = the current size, b = the final size and y = the percentage done, this gets the data and solves for y and converts to an integer. (Do I really need it to seven points? No.).

Thank you -E for making command-line Perl so much easier