[TxMt] help with perl search/replace

Brad Choate bchoate at gmail.com
Sun May 21 23:02:41 UTC 2006


Yes,

When you use the -p switch, it takes the input (from the stdin pipe)  
and processes it, line by line. So, a line will have no more than one  
"\n" in it.

See the documentation for the "-p" switch here:
	http://perldoc.perl.org/perlrun.html

What you may want to do is this:

	perl -pe 'BEGIN {$/=undef} s/\n\n/foo/'

$/ is the Perl special variable for the end-of-line delimiter.  
Changing it to undef causes it to read the input in all at once.


On May 21, 2006, at 3:40 PM, Oliver Taylor wrote:

> Is there any reason the following shouldn't work?
>
> perl -pe 's/\n\n/foo/;'
>
> ...no I don't speak perl.
>
> I'm doing this via, "filer thru command".
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate




More information about the textmate mailing list