modify the sed rule to get the size of the page and add loop for
calculating total page size