Noob Question - Line Count

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

w33d123
Posts: 1
Joined: Thu Feb 11, 2010 11:55 pm

Noob Question - Line Count

Postby w33d123 » Fri Feb 12, 2010 12:04 am

Hi,

As previously mentioned, I am new to textpipe. I am formatting a delimitted file (just one file at a time). I would like to add a footer with a tally of a specific type of line.

Say file looks like so:

Header|fdsfdas|dsads
D|xxxx|yyyy
D|xxxx|yyyy
D|xxxx|yyyy
Footer|linecount|

I need to tally the lines beginning with D|

Is it possible to store this value as a global variable?

Any help would be greatly appreciated.

User avatar
DataMystic Support
Site Admin
Posts: 2154
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Noob Question - Line Count

Postby DataMystic Support » Fri Feb 12, 2010 8:27 am

Yes - use a Filters\Restrict\Matching lines (grep) so that you only count matching lines, and INSIDE this, add a Filters\Special\Script (VBScript,JScript...) to simply keep a tally of the number of lines.

Then at the bottom of your filter list, add another Filters\Special\Script (VBScript,JScript...), but this time to output the count in the endFile() function.
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments


Return to “TextPipe Tips and Tricks, Questions and Support”

Who is online

Users browsing this forum: No registered users and 4 guests