Page 1 of 1
Delete fields when fields match but leave first field .
Posted: Wed Mar 17, 2010 12:48 am
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.
Re: Delete fields when fields match but leave first field .
Posted: Wed Mar 17, 2010 5:16 am
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.
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.
Re: Delete fields when fields match but leave first field .
Posted: Wed Mar 17, 2010 1:46 pm
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!
Re: Delete fields when fields match but leave first field .
Posted: Thu Mar 18, 2010 7:51 am
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!