Count the number of times a line is in a file

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

Post Reply
Posts: 1
Joined: Fri May 23, 2008 4:37 am

Count the number of times a line is in a file

Post by gotcher » Fri May 23, 2008 4:51 am

I want to look at the all of the characters up to the first comma (it may very in size) in a line and see how many times that line shows up in a file and then append that number to the end of the line.

The example file would look like:

then the out put would be:

Any help is greatly appreciated.

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

Re: Count the number of times a line is in a file

Post by DataMystic Support » Thu May 29, 2008 4:04 pm

The trick is to pad the first CSV field to the maximum width (e.g. 30) using Filters\Restrict\Delimited fields (CSV, Tab, Pipe, etc) and Filters\Add\Pad to width, then do a count based on matching just this part of the line.

Simon Carter, - Insulin dose calculator for Type 1 diabetes - 250,000 free software downloads - send huge email attachments

Post Reply