LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   ed command problem (http://www.linuxquestions.org/questions/programming-9/ed-command-problem-870485/)

moata_u 03-23-2011 09:47 AM

ed command problem
 
i have write the following script :
Code:

ed -s application.properties << EOF
  g/=rmi\\\\:\/\/[^\]*/s||=rmi\\\\://$host_ip|
  w
EOF

and that's work perfectly when i run it in terminal ...
i saved that script in a file, when i try run that file i always got the following error : unexpected end of file ....?? it seems i need to add quot , slash ...`` , '' ....am not sure i have tried nothing work !!

any idea ??

jschiwal 03-23-2011 10:16 AM

You need a q command so that ed quits. It is expecting further input, which could come from stdin in this case.

You could probably use:
ed -s application.properties < edcommands

Instead of a HERE document, if this is the entire script.

moata_u 03-23-2011 02:09 PM

Code:

You could probably use:
ed -s application.properties << edcommands

i already tried that , but does not work as well....

jschiwal 03-23-2011 05:41 PM

I made a mistake. Use "ed -s application.properties <edcommands"
First add the 'q' command to the end of ed.commands so that ed quits.

I'll edited my previous message.


All times are GMT -5. The time now is 08:09 PM.