Jump to content


Photo

Special characters - /N dissappers in command.


  • Please log in to reply
1 reply to this topic

#1 vidyashankara

vidyashankara
  • Members
  • PipPipPip
  • Advanced Member
  • 75 posts

Posted 26 June 2006 - 06:34 PM

I am calling the following system command

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

for some reason, It changes to

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

the /n is missing.

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

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

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 26 June 2006 - 07:55 PM

\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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users