restrict line range problem

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

wing_tong
Posts: 3
Joined: Wed Mar 09, 2005 1:10 pm

restrict line range problem

Postby wing_tong » Wed Mar 09, 2005 1:24 pm

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

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

Postby DataMystic Support » Wed Mar 09, 2005 4:09 pm

This is expected behaviour - your file has less than 3 lines.
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

wing_tong
Posts: 3
Joined: Wed Mar 09, 2005 1:10 pm

Postby wing_tong » Wed Mar 09, 2005 4:27 pm

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

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

Postby DataMystic Support » Wed Mar 09, 2005 4:40 pm

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

Guest

Postby Guest » Wed Mar 09, 2005 4:54 pm

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,,,,,

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

Postby DataMystic Support » Thu Mar 10, 2005 10:43 am

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

Guest

Postby Guest » Thu Mar 10, 2005 11:42 am

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.

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

Postby DataMystic Support » Thu Mar 10, 2005 12:13 pm

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

wing_tong
Posts: 3
Joined: Wed Mar 09, 2005 1:10 pm

Postby wing_tong » Thu Mar 10, 2005 4:14 pm

Thanks for you support.

Regards


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

Who is online

Users browsing this forum: Bing [Bot] and 1 guest