You might had this experience many times while working
in day to day Unix environments..
Viewing
a Unix file very common in any Unix based task, however, there are large files
in form of any log or any other data. Viewing such files really annoying to any
administrator when this hits the following error.
Out of memory saving lines for undo - try
using ed
:
The reason why above error, default maximum lines can be displayed by "vi" editor is
1,048,560 so anything file more than 1,048,560 lines will not be displayed with
"vi" editor.
May be
below will show what you're looking for but will not allow much flexibility to
view complete file
View the first 200 records
$head -n 200 yourfile.log |pg
to view the last 200 records
$tail -200 yourfile.log
How to solve this problem
"-y" switch of
"vi" editor allows to 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.
Example
Below
the command will set vi editors to display 99999999 lines at run time.
$vi -y 99999999 yourfile.log
More
information you can find out with "man vi".
Hope
this helps. Please let me know in case any queries.
Thanks a lot, very helpful.
ReplyDeleteThank you Anish
DeleteVery Helpful ...Thanks For Sharing ...Keep Up The Good Work...
ReplyDelete