How to? TPIPE ?'s

Apr 2, 2011
1,294
3
53
North Carolina, USA
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
 
May 20, 2008
10,684
83
Syracuse, NY, USA
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.
 
May 20, 2008
10,684
83
Syracuse, NY, USA
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