how to grep number of rows in vi

GP7
GP7 used Ask the Experts™
on
Hi,

What is the command to grep number of rows in vi editor? i need to grep the number of records from a log file. each record has a lot of cols which extend upto many lines. now i want to grep the number of records... not lines.

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2013
Top Expert 2013

Commented:
Try <Ctrl><g>
(press  Ctrl and  g simultaneously. Do not press colon  :   !)
You will see a message "The cursor is at line l of n --- xx % ---",  or "n lines -- x% --"
with n being the number of rows in the file.
wmp
Top Expert 2007
Commented:
you mat do the following while you are in vi editor and in command mode

:set nu

then go to file end

:$

Or from command line

wc -l filename
GP7

Author

Commented:
Thanks
Most Valuable Expert 2013
Top Expert 2013

Commented:
What was wrong with my answer? <ESC><Ctrl><g> is much faster to type than <ESC><:>set nu<enter><:><$><enter>

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial