Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 168
  • Last Modified:

File size is different in vi as opposed to when it is shown in the directory

I have a Linux ascii text file. The size shows 234642925 when I do: ls -l. However, when I do a vi on it, at the bottom the size shows as 234642973C where C is the number of characters. Can you anybody tell me why?
0
soccerplayer
Asked:
soccerplayer
1 Solution
 
ssvlCommented:
by default, vi enforces the upper limit of 1,048,560 lines. If you have a file that has more lines than this, then you need to change this default value by starting vi using the -yNumber option. Following is an excerpt from the man page for -yNumber on Libra:
"-yNumber Overrides the maximum line setting of 1,048,560 with any value greater than 1024. You should request twice the number of lines that you require because the vi editor uses the extra lines for buffer manipulation."
0
 
jaredcallCommented:
it may be that ls shows the file size on disk (including partially allocated blocks).  vi wouldn't care about that, just character count.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now