Jump to content
Macro Express Forums

Count number of lines in text file

Recommended Posts

I am wanting to be able to count the number of lines in a text file and put that amount into a variable. It seems so simple, but I can't figure it out. Is there an easy way to do this?

Share this post

Link to post
Share on other sites

Try this:

Variable Set Integer %N1% to 0
Text File Begin Process: "FileIn.txt"
  Variable Modify Integer: Inc (%N1%)
Text File End Process

// Here %N1% contains the number of lines

Copy and paste this code:

<IVAR2:01:01:0><BTFBEG:001:000001:000000:c:\Users\username\Documents\FileIn.txt><NMVAR:08:01:0:0000001:0:0000000><BTFEND><REM2:><REM2:Here %N1% contains the number of lines>


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...