Line count of file

We all have been there waiting for a huge file to load in our fav editor. Knowing the number of lines in the file does not hurt. Check out below commands:

Windows:

find /c /v “hffhsdfsdlkfjsdlfj” <file_path>

/c – Displays only the count of lines containing the string “hffhsdfsdlkfjsdlfj”

/v – Displays all lines not containing “hffhsdfsdlkfjsdlfj”

PS: make sure you don’t expect “hffhsdfsdlkfjsdlfj” string in the file

Unix:

wc -l <file_path>

Advertisements

About Badal Chowdhary

I am a Software Engineer by profession. I have done SCJP and SCWCD certifications. Like working on cutting edge technologies and frameworks. Driven by challenges and fascinated by technology. I love playing and watching sports: Cricket, Ping Pong, Tennis, Badminton, Racket Ball and Gym.
This entry was posted in Unix, Windows and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s