0

i used this

$ rc = system("sed -e 's/Monyear/$Month//g' <
  $Script_Path/Mailcontent.txt.template > $Script_Path/Mailcontent.txt");

in a mailing script

i'm getting error like

sed: -e expression #1, char 19: unknown option to `s'
user1630087
  • 811
  • 1
  • 7
  • 5
  • 1
    What is this `system()` function? It's not part of bash. – ghoti Sep 17 '12 at 11:08
  • @ghoti `system()` is a function used to call a system default application in most programming languages. For example, if you call `system("cls")` on windows, it will clear command prompt screen and `system("clear")` on unix, will clear unix terminal. Sed is a unix default application. – ghaschel Sep 17 '12 at 12:51
  • 1
    @ghaschel - If you're aware of the programming language that the OP is using, please add an appropriate tag. The only programming languages tagged for this question at the moment are shell and sed. As it is, this looks like an [XY Problem](http://mywiki.wooledge.org/XyProblem). – ghoti Sep 17 '12 at 13:47
  • @ghoti I am not aware of the programming language he is using, I just said that because using `system()` is something I do sometimes. Not saying it is not a XY Problem. Just clarifying my answer. – ghaschel Sep 17 '12 at 13:52
  • 1
    @ghaschel - I don't see an answer from you. And I *am* suggesting this is an XY problem. Most languages that include a `system()` or `exec()` function have their own methods for opening and manipulating files. It is almost always safer and faster to use those than to run commands like this. This question asks for help implementing a solution to a problem we don't actually know. – ghoti Sep 17 '12 at 14:51

1 Answers1

4

You have one / too much. Do this:

s/Monyear/$Month/g