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:
A test program.
Quote:
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.


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. |
Quote:
#!/usr/bin/sed -i.bak -s -nf \%<something% { s=thing1=thing2= } p |
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.