Delete fields when fields match but leave first field .

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

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

Delete fields when fields match but leave first field .

Postby WzevGIlK » Wed Mar 17, 2010 12:48 am

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.

User avatar
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 .

Postby AnthonyFitz » Wed Mar 17, 2010 5:16 am

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

Postby WzevGIlK » Wed Mar 17, 2010 1:46 pm

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!

User avatar
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 .

Postby AnthonyFitz » Thu Mar 18, 2010 7:51 am

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


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

Who is online

Users browsing this forum: No registered users and 3 guests