Page 1 of 1

Remove Line after 2 columns match or don't match

Posted: Tue Oct 05, 2004 3:34 am
by cngpros
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 ?

Posted: Wed Oct 06, 2004 11:55 am
by DataMystic Support
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)

Posted: Wed Oct 06, 2004 10:18 pm
by cngpros
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.

Posted: Wed Oct 06, 2004 10:33 pm
by DataMystic Support
Correct - [null] does not mean 'nothing'.

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

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

Posted: Fri Oct 08, 2004 10:48 pm
by cngpros
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.

Posted: Sat Oct 09, 2004 7:37 am
by DataMystic Support
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?