Select all lines from the start... and delete them all

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

kobong
Posts: 5
Joined: Sun Oct 08, 2006 5:52 pm

Select all lines from the start... and delete them all

Postby kobong » Sun Oct 08, 2006 5:59 pm

Hello

I have filter:

“Select all lines from the start of the file until a line starting with DeliveredDate:”

My question is: how to delete all matching lines (instead of changing them into upper case - as is default now).

I've used subfilter Remove all, but it doesn't work. So: how to delete all matching (to the line: "DeliveredDate:") lines?

Please, give me filter:

“DELETE all lines from the start of the file until a line starting with DeliveredDate:”

Best regards!
Peter

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

Postby DataMystic Support » Mon Oct 09, 2006 8:51 am

Did you add this as a subfilter, or just below the select filter? Please email us your filter, or read the help on creating subfilters.
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

kobong
Posts: 5
Joined: Sun Oct 08, 2006 5:52 pm

Postby kobong » Mon Oct 09, 2006 2:12 pm

Hello!

First, I use normal Your VBScript script:


Code: Select all

Filter List
-----------
|--VBScript script  Timeout: 10000 milliseconds
|  |  'Select all lines from the start of the file until a line starting with DeliveredDate:
|  | 
|  |  dim textFound
|  | 
|  |  'Called for every line in the file
|  |  'EOL contains the end of line characters (Unix, DOS or Mac) that must be
|  |  'appended to each line
|  |  function processLine(line, EOL)
|  | 
|  |    if InStr( line, "DeliveredDate:" ) = 1 then
|  |      textFound = true
|  |    end if
|  | 
|  |    if not( textFound ) then
|  |      processLine = TextPipe.subFilterEntireText(line) & EOL
|  |    else
|  |      processLine = line & EOL
|  |    end if
|  | 
|  |  end function
|  | 
|  | 
|  |  'Called before each file is opened -
|  |  'perform per-file initialisation here
|  |  function startFile()
|  |    textFound = false
|  |    startFile = ""
|  |  end function
|  | 
|  | 
|  |  'Called before each file is closed -
|  |  'flush all pending file output here
|  |  function endFile()
|  |    endFile = ""
|  |  end function
|  | 
|  | 
|  |  'Called at the start of a processing job -
|  |  'perform one-time initialisation here
|  |  sub startJob()
|  |    'do nothing
|  |  end sub
|  | 
|  | 
|  |  'Called at the end of a processing job -
|  |  'destroy any declared objects here
|  |  sub endJob()
|  |    'do nothing
|  |  end sub
|  | 
|  | 
|  |
|  +--Convert to UPPERCASE [THERE IS THE CRUCIAL ELEMENT]
|     
+--Output to file(s)


But, please, tell me, what kind of (sub)filter - (sub)command - should I use (instead of default: Convert to UPPERCASE) in order to DELETE all matching lines, it is: form the start of the file until a line starting with DeliveredDate:

Thank You in advance!
Peter

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

Postby DataMystic Support » Mon Oct 09, 2006 8:09 pm

That VBScript code will not work.

Use this simple search/replace filter instead:


Code: Select all

Perl pattern [(.*)(^DeliveredDate:)] with [$2]
   [ ] Match case
   [ ] Whole words only
   [ ] Case sensitive replace
   [ ] Prompt on replace
   [ ] Skip prompt if identical
   [ ] First only
   [ ] Extract matches
   Maximum text buffer size 409600
   [ ] Maximum match (greedy)
   [ ] Allow comments
   [X] '.' matches newline
   [ ] UTF-8 Support
 
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

kobong
Posts: 5
Joined: Sun Oct 08, 2006 5:52 pm

Postby kobong » Tue Oct 10, 2006 3:35 pm

Thank You, it works indeed, but by the use of the filter:

“select from start to matching line.fll”

tasks could by done more sophisticated, even: faster.

The one thing what the User need is filter:

“remove from start to matching line.fll”

(and – prospectively: “remove from matching line to the end of file.fll”)

but today (7.6.1) there is no such filter(s).

Anyway: Your regex-tip is working. Thank you once more!

Bye, bye.

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 11, 2006 10:45 am

Thanks - we'll include those in the next release
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: No registered users and 11 guests