Page 1 of 1

restrict line range problem

Posted: Wed Mar 09, 2005 1:24 pm
by wing_tong
Hi,

Please help, whether I have encountered a bug or I have used a wrong filter (textpipe pro 7.2).

File 1:
CR:123
field 1, field 2, field3
field 11, field 22, field33

File 2:
CR:123

Filter:
>append footer "N, no result found"
>restrict to line 3 to end - 0
>> remove line matching "N, no result found"

I run the filter on all files at once, Result:
File 1:
CR:123
field 1, field 2, field3
field 11, field 22, field33

File 2:
CR:123
N, no result foundfield 1, field 2, field3
field 11, field 22, field33


Regards

Posted: Wed Mar 09, 2005 4:09 pm
by DataMystic Support
This is expected behaviour - your file has less than 3 lines.

Posted: Wed Mar 09, 2005 4:27 pm
by wing_tong
Hi,

But isn't that each file should be processed individually?

What should I do, if I want to get the following result in File 2? (I get the following result when I run the filter for File 2 only)

CR:123
N, no result found


Regards

Posted: Wed Mar 09, 2005 4:40 pm
by DataMystic Support
Can you send me your filter? I don't think it's setup correctly. Alternatively, use File\Export\to clipboard to paste a text representation here.

Posted: Wed Mar 09, 2005 4:54 pm
by Guest
Hi,

here are the filter, source file, output files :-



TextPipe Single User Edition
Purchased by: wing, Azeus Systems Limited

Filter Title:

Filter List
-----------
Filter options
| [ ] Log to file
| [X] Append to logfile
| Log filename: textpipe.log
| Threshold 500
|
|--Input from file(s)
| [ ] Confirm before processing each file
| [ ] Confirm before processing read/only files
| [ ] Delete input files after processing
| Process binary files
|
|--Comment...
| | 6. Insert "No call made OR ported out"
| |
| |--Add footer [N,No call made OR ported out,]
| |
| +--Restrict lines:Line 3 .. line END - 0
| |
| +--Remove matching lines [N,No call made OR ported out,]
| [ ] Include line numbers
| [ ] Include filename
| [ ] Match case
| [ ] Count matches
| Pattern type: 4
| Context before: 0
| Context after: 0
|
+--Output to file(s)
[ ] Only update date on changed files
[ ] Keep original file's date and time
[ ] Append mode
[X] Change extension to: .cr2
Output folder: C:\
[X] Maintain folder structure


Files List
----------
c:\estar\sp_root\result\*.cr


Source File 1: a.cr
CR:90101111
,,,,,90101111,,,,,,2005-02-03,12:54:51,,000008,,,21,,,191390165637,,,,,
,,,,,90101111,,,,,,2005-02-03,12:54:51,,000008,,,21,,,191390165637,,,,,
,,,,,90101111,,,,,,2005-02-03,12:54:51,,000008,,,21,,,191390165637,,,,,
,,,,,90101111,,,,,,2005-02-03,12:54:51,,000008,,,21,,,191390165637,,,,,

Source File 2: b.cr
CR:90101111

Output File 1: a.cr2
CR:90101111
,,,,,90101111,,,,,,2005-02-03,12:54:51,,000008,,,21,,,191390165637,,,,,
,,,,,90101111,,,,,,2005-02-03,12:54:51,,000008,,,21,,,191390165637,,,,,
,,,,,90101111,,,,,,2005-02-03,12:54:51,,000008,,,21,,,191390165637,,,,,
,,,,,90101111,,,,,,2005-02-03,12:54:51,,000008,,,21,,,191390165637,,,,,

Output File 2: b.cr2
CR:90101111
N,No call made OR ported out,,,,,,90101111,,,,,,2005-02-03,12:54:51,,000008,,,21,,,191390165637,,,,,
,,,,,90101111,,,,,,2005-02-03,12:54:51,,000008,,,21,,,191390165637,,,,,
,,,,,90101111,,,,,,2005-02-03,12:54:51,,000008,,,21,,,191390165637,,,,,

Posted: Thu Mar 10, 2005 10:43 am
by DataMystic Support
What are you trying to do?

I think you need to remove the Restriction, and just alter the 'Context lines' option of the 'Remove matching lines' filter.

Posted: Thu Mar 10, 2005 11:42 am
by Guest
I want to add the line "N,No call made OR ported out" if the file contains no lines except the header line. where the header line may change from file to file, but there is only 1 header line for each file.

so the result, i'm expecting is:
File 1 - no change
File 2 - the line "N,No call made OR ported out" is append at the end.

Regards.

Posted: Thu Mar 10, 2005 12:13 pm
by DataMystic Support
Why not add that line always, and then remove it with a simple pattern search/replace?

Search for EasyPattern:

[ capture(2 or more (lines )) ]N,No call made OR ported out

Replace with

$2

You might need to tweak the pattern a little. Files with only a header line will NOT match the pattern, and hence your footer line will remain.

Posted: Thu Mar 10, 2005 4:14 pm
by wing_tong
Thanks for you support.

Regards