Jump to content

Archived

This topic is now archived and is closed to further replies.

vidyashankara

Special characters - /N dissappers in command.

Recommended Posts

I am calling the following system command

[code]
$command = "sed '1~3 {N;N;s/\n //g}' $biofile > $id.biomat1";
s ystem($command, $output);
[/code]

for some reason, It changes to

[code]
$command - sed '1~3 {N;N;s/ //g}' $biofile > $id.biomat1";
[/code]

the /n is missing.

I changed it to
[code]
$command = "sed '1~3 {N;N;s/\ ".\n." //g}' $biofile > $id.biomat1";
s ystem($command, $output);
[/code]

but the php has a space between \ and n. How do i get rid of that space?

Share this post


Link to post
Share on other sites
\n creates a newline, do you want to us \n as-is, ie not make a newline, if you do then use this:
\\n (two forward slashes)

PHP will then use \n as-is, it will not convert \n to a newline.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.