Home > Net >  how to use Sed to add spicial charectar?
how to use Sed to add spicial charectar?

Time:11-02

how to use Sed to add spicial charectar ?

script shell: the chalange is:

I have a large file xx.html:

... ... ...

my quastion is how can I use sed command to insert this line: secure_token = '' function getipInfo()

to xx.html file before

</body>  line


I try to much scinario , alwase there is issue in php charectar 

sed -i '102i secure_token = \'\<\?php \e\cho file_get_contents\(\"token.txt\"\); \?\>\'\n
   function getipInfo()' xx.html



CodePudding user response:

how to insert

 secure_token = '<?php echo file_get_contents("token.txt"); ?>'    function getipInfo()

into a file using sed

CodePudding user response:

If you want to insert this line before </body>:

sed -i '/^<\/body>/i  secure_token = \x27<?php echo file_get_contents("token\.txt"); ?>\x27    function getipInfo()' xx.html
  • Related