Delete fields when fields match but leave first field .

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
WzevGIlK
Posts: 10
Joined: Tue Mar 16, 2010 11:32 pm
Contact:

Delete fields when fields match but leave first field .

Post by WzevGIlK »

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.
AnthonyFitz
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 .

Post by AnthonyFitz »

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.
TextPipeForum_Filter_for_WzevGIlK_By_AnthonyFitz.zip
(672 Bytes) Downloaded 533 times
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
WzevGIlK
Posts: 10
Joined: Tue Mar 16, 2010 11:32 pm
Contact:

Re: Delete fields when fields match but leave first field .

Post by WzevGIlK »

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!
AnthonyFitz
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 .

Post by AnthonyFitz »

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
Post Reply