Article 5FZJB Sed options rejected in #!/usr/bin/sed invocation

Sed options rejected in #!/usr/bin/sed invocation

by
selfprogrammed
from LinuxQuestions.org on (#5FZJB)
Sed will not let me specify options in this situation.
It seems to be limited to "-nf".
I need more than just that.
I need to process all files in a directory.
>> mysed src/*.c

I want the option of backup files.

The problem is that sed rejects the following:
Quote:
#!/usr/bin/sed -i.bak -s -nf
Sed complains that the space is an unrecognized script command.

#!/usr/bin/sed -n-nf
Sed complains that the second '-' is an unrecognized script command.
A test program.
Quote:
#!/usr/bin/sed -i.bak -s -nf
\%<something% {
s=thing1=thing2=
}
p
The only solution I have found is to separate the script into a separate file.
Now I continually have problems with that sed file not being found because I moved to a different directory. I don't really want to have to "install" this sed script to /usr/share.
I can work out for myself other ways to "install" it, that is not the question.

Does anyone know of a way to get the sed invocation and the sed script into the same Bash script ?
And be able to specify the usual range of sed options ?

I have thought of just trying AWK again, but my last experience with that drove me back to sed.

Thank You.latest?d=yIl2AUoC8zA latest?i=uvfisl8Ltsw:Nk4nkshUkbQ:F7zBnMy latest?i=uvfisl8Ltsw:Nk4nkshUkbQ:V_sGLiP latest?d=qj6IDK7rITs latest?i=uvfisl8Ltsw:Nk4nkshUkbQ:gIN9vFwuvfisl8Ltsw
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments