I had a confusion with this topic between switching between command line and script file interface. I had a nice script written out in the command line that worked, but as soon as I wanted to save it to a .sed file, I remembered I could no longer use the -n
. I tried using '!d' flag, but I'm not getting the same output. My question:
Is there a way to put the -n
in a .sed file, or some other way to stop the automatic printing when I'm in script file interface? I hate to have to convert from protecting my script from the shell to not protecting it, but I guess there is no way around it?
|
||||
The standard (POSIX) way is to have That precludes the use of a she-bang, that's only to be used for scripts run as
If you want to make an executable Note that the
And you can add more text after like:
Or:
Actually, that's something to bear in mind to avoid turning
|
|||||
|
|
|||
|
You will either have to run the
or change the
and run it with
|
||||
|
-n
and-f
command line options together for some reason? – steeldriver 8 hours agosed -f
from the command line, or using#!/usr/bin/sed -f
at the top of the file? Either way, replacing the-f
with-nf
should work. – Daniel H 7 hours ago