TextEdit Get the count of lines in a file

There is no status bar for the TextEdit application on the Mac to show the word or the line count of a file.

If you want to know the number of lines in a file using TextEdit, you would need to use a hack using the Find option.

  1. Open the file in TextEdit
  2. Now go to Edit -> Find -> Find... (or simply press Command + F)
  3. Now on the search icon (magnifying glass, click on Insert Pattern.
    Select Inspect pattern
  4. Choose line break.
    Select Pattern Line Break
  5. You should see a count of all the line breaks in the file and this is the number of lines (add one to the count) in the file.
How to do a line count in TextEdit

As you can see I get a count of 4, need to add one to get the total count of the lines the file.

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap