Pleeease help! How to Delete fields when fields match but leave first field.
Ex. (csv):
Seattle,any,any,any,any
Seattle,any,any,any,any
Seattle,any,any,any,any
Boston,Boston-any,Boston-any,Boston-any,Boston-any
Seattle,any,any,any,any
Boston,Boston-any,Boston-any,Boston-any,Boston-any
I want:
Seattle,any,any,any,any
,any,any,any,any
,any,any,any,any
,any,any,any,any
Boston,Boston-any,Boston-any,Boston-any,Boston-any
,Boston-any,Boston-any,Boston-any,Boston-any
Thank you.
Delete fields when fields match but leave first field .
Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators
-
- Posts: 11
- Joined: Mon Aug 25, 2008 9:16 pm
- Location: Dublin and Manila
- Contact:
Re: Delete fields when fields match but leave first field .
Hi WzevGIlK,
I think this filter should work for you. I did some tests and it seems to work on the sample data I threw at it. Input
Seattle,any,any,any,any
Seattle,any,any,any,any
Seattle,any,any,any,any
Boston,Boston-any,Boston-any,Boston-any,Boston-any
Seattle,any,any,any,any
Boston,Boston-any,Boston-any,Boston-any,Boston-any
Boston,Boston-any,Boston-any,Boston-any,Boston-any
Dublin,any,any,any,any
Dublin,any,any,any,any
Dublin,any,any,any,any
Output
Boston,Boston-any,Boston-any,Boston-any,Boston-any
,Boston-any,Boston-any,Boston-any,Boston-any
,Boston-any,Boston-any,Boston-any,Boston-any
Dublin,any,any,any,any
,any,any,any,any
,any,any,any,any
Seattle,any,any,any,any
,any,any,any,any
,any,any,any,any
,any,any,any,any
Just create a filter with the following steps:
1. Add a sort filter which you can find in the [Special] section
Use these parameters:
Ascending ANSI sort (case insensitive)
2. Add a Find Pattern (Perl Style) which you can find in [Replace] section
Use these parameters:
Find : ^([^,]+?)(.+?^\1)
Replace : Action - Send Variable 2 to Sub Filter
3. Add another Find Pattern (Perl Style) as a sub Filter to the previous Find Pattern.
Use these parameters:
Find : ^[^,]+
Replace:
(Just replace with blank)
Thats it!
Regards,
Anthony.
I think this filter should work for you. I did some tests and it seems to work on the sample data I threw at it. Input
Seattle,any,any,any,any
Seattle,any,any,any,any
Seattle,any,any,any,any
Boston,Boston-any,Boston-any,Boston-any,Boston-any
Seattle,any,any,any,any
Boston,Boston-any,Boston-any,Boston-any,Boston-any
Boston,Boston-any,Boston-any,Boston-any,Boston-any
Dublin,any,any,any,any
Dublin,any,any,any,any
Dublin,any,any,any,any
Output
Boston,Boston-any,Boston-any,Boston-any,Boston-any
,Boston-any,Boston-any,Boston-any,Boston-any
,Boston-any,Boston-any,Boston-any,Boston-any
Dublin,any,any,any,any
,any,any,any,any
,any,any,any,any
Seattle,any,any,any,any
,any,any,any,any
,any,any,any,any
,any,any,any,any
Just create a filter with the following steps:
1. Add a sort filter which you can find in the [Special] section
Use these parameters:
Ascending ANSI sort (case insensitive)
2. Add a Find Pattern (Perl Style) which you can find in [Replace] section
Use these parameters:
Find : ^([^,]+?)(.+?^\1)
Replace : Action - Send Variable 2 to Sub Filter
3. Add another Find Pattern (Perl Style) as a sub Filter to the previous Find Pattern.
Use these parameters:
Find : ^[^,]+
Replace:
(Just replace with blank)
Thats it!
Regards,
Anthony.
http://www.TheLocalizer.com/
High Quality, Low Cost, Localization Engineering, Testing, Audio & Video Services
High Quality, Low Cost, Localization Engineering, Testing, Audio & Video Services
Re: Delete fields when fields match but leave first field .
Wonderful! So easy! I had to do it through notepad. Adding using TextPipe "-=", first column and then in Notepad to remove after the first line - find and replace text down (-=Seattle, and -=Boston etc). It was a long and tired eyes. Anthony! Thank you very much! The program is very good!
-
- Posts: 11
- Joined: Mon Aug 25, 2008 9:16 pm
- Location: Dublin and Manila
- Contact:
Re: Delete fields when fields match but leave first field .
Yeah, Text Pipe Pro is the best tool out there for text manipulation, and writing regular expressions is like writing poetry, when it works!
http://www.TheLocalizer.com/
High Quality, Low Cost, Localization Engineering, Testing, Audio & Video Services
High Quality, Low Cost, Localization Engineering, Testing, Audio & Video Services