Welcome!

By registering with us, you'll be able to discuss, share and exchange private messages with other members of our community.

SignUp Now!

How to? TPIPE ?'s

Apr
1,737
15
With TPIPE can I do:

1 - replace BOL then [, then any number of chars, up to and including ], with nothing, thereby removing the search phase?

2 - replace EOL, BOL, space, with a space?

for example:

NOTE next line is before, 2nd line is after replacement
[] error on this page
error on this page

=============================
NOTE next line is before, 2nd line is after replacement

this is an error on page 500
capitalization

this is an error on page 500 capitalization
 
1.

Code:
v:\> echo [foo]bar | tpipe /replace=4,0,0,0,0,0,0,0,0,"\[.*\]",""
bar

2. I use this alias for replacing newlines (and tabs, and multiple spaces) with a single space.

Code:
v:\> alias crunch
tpipe /replace=4,0,0,0,0,0,0,0,0,"[ \r\n\t]+?"," "

Code:
v:\> type now.txt
now
        is
  the
       time.

v:\> type now.txt | crunch
now is the time.
 
Here's a better one for #1. It only gets rid of [...] at the beginning of the line.

Code:
v:\> echo [foo]bar[foo]bar | tpipe /replace=4,0,0,0,0,0,0,0,0,"^\[.*\]",""
bar[foo]bar
 

Similar threads

Back
Top