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:
1234567890,11111,5/22/2008,6/22/2008,01,400.00
1234567890,11111,5/22/2008,6/22/2008,02,100.00
1234567890,11111,5/22/2008,6/22/2008,03,120.00
0987654321,22222,5/22/2008,6/1/2008,01,123.65
then the out put would be:
1234567890,11111,5/22/2008,6/22/2008,01,400.00,3
1234567890,11111,5/22/2008,6/22/2008,02,100.00,3
1234567890,11111,5/22/2008,6/22/2008,03,120.00,3
0987654321,22222,5/22/2008,6/1/2008,01,123.65,1
Any help is greatly appreciated.
Count the number of times a line is in a file
Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators
- DataMystic Support
- Site Admin
- Posts: 2227
- Joined: Mon Jun 30, 2003 12:32 pm
- Location: Melbourne, Australia
- Contact:
Re: Count the number of times a line is in a file
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.