Remove Line after 2 columns match or don't match

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

cngpros
Posts: 4
Joined: Tue Oct 05, 2004 3:23 am

Remove Line after 2 columns match or don't match

Postby cngpros » Tue Oct 05, 2004 3:34 am

I was attempting to nest subfilters to delete the line if the two of the columns were blank or empty.

Restrict column 1
> subfilter: Match parttern
>> subfilter: Restrict Column 7
>>> subfilter: Match Parttern
>>>> subfilter: remove line

I do not have a working script as of this posting.

I have ten columns of data that may or may not be blank but if two of the columns, 1 and 7, are blank I want to delete the line and not include any of the columns in the final output.

Does this require an expression that takes into account every column or is there a different way to match and delete for multiple columns in one filter ?

User avatar
DataMystic Support
Site Admin
Posts: 2164
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Postby DataMystic Support » Wed Oct 06, 2004 11:55 am

Your filter will not work - restrictions, as their name implies, restrict the text that is passed to the subfilters.

The best approach is to
1) Restrict to field 1
2) If empty, insert a special character (eg \xFF)
3) Restrict to field 7
4) If empty, insert a special character (eg \xFF)
5) Remove all lines with 2 special characters (eg \xFF)
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

cngpros
Posts: 4
Joined: Tue Oct 05, 2004 3:23 am

Postby cngpros » Wed Oct 06, 2004 10:18 pm

Turns out that the field can have null or blank. Example of 10 field data line: "|f2|f3|f4|f5|f6||f8|f9|f10" F1 and F7 are empty.

Tried using [null] and [null or whitespace] with easypattern and did not find a match on f1 and f7.

User avatar
DataMystic Support
Site Admin
Posts: 2164
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Postby DataMystic Support » Wed Oct 06, 2004 10:33 pm

Correct - [null] does not mean 'nothing'.

Find perl pattern
^\s*$
Replace with
\xff

The field restriction must be set to exclude the field delimiter.
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

cngpros
Posts: 4
Joined: Tue Oct 05, 2004 3:23 am

Postby cngpros » Fri Oct 08, 2004 10:48 pm

I understand that I need to insert a value like xFF.

two issues for me. Empty is the key the field is empty no null, spaces etc.

1. logic needed.
if f1 is empty AND f7 is empty)
delete line
else
keep line
endif
How do I only DELETE lines that have two xFF

2.
field 1 or 7 maybe a empty, null or whitespace and I need to recognize them all. How do I recognize the fact that the field has null so I can insert the xFF ?

Using easy pattern [null or whitespace] does not match the field.

-------------
Also why isn't this forum sending notify when answer is posted ? I have set the flag for my logon.

User avatar
DataMystic Support
Site Admin
Posts: 2164
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Postby DataMystic Support » Sat Oct 09, 2004 7:37 am

1. Use a remove lines not matching perl pattern

\xFF.*\xFF

2. Read my previous post, which uses a perl pattern.
--
The notification email works for me, can you check you email address in your profile?
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments


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

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot] and 2 guests