I want to count number of pages in the file /var/log/messages
, so that I can use pr
command to start printing from the page I want to.
For example, suppose that /var/log/messages
file contains 300 pages, then I can use the following to print last 5 pages.
pr +295 /var/log/messages
Note: pr
command will list the page count when we specify page number that exceeds number of pages available in the file as mentioned below.
pr +400 /var/log/messages
pr: starting page number 400 exceeds page count 313
Having said that I would like know if there is a specific command to find the page count.
Best Answer
pr
default page length for text file is56
. So you can do like this:If you want to count many files, try: