sed error "unescaped newline inside substitute pattern"

Mike Clarke jmc-freebsd2 at milibyte.co.uk
Sat Mar 14 03:04:57 PDT 2009


On Friday 13 March 2009, David Banning wrote:

> Yes - I have control of that - so I could filter out the problem in
> php. The only problem is that I don't know what I am filtering.
> If I know exactly what the erroneous characters are I could filter
> them - I have looked at the file in vi but the problematic characters
> are invisible there.

Would the php addcslashes() function do what you need?

<?php
$in = "This
is
the
input
from the
web server";
$out = addcslashes($in,"\n");
var_dump ($out);
?>

This results in:

string(42) "This\nis\nthe\ninput\nfrom the\nweb server" 

-- 
Mike Clarke


More information about the freebsd-questions mailing list