Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Sed Question

57 views
Skip to first unread message

Doc Trins O'Grace

unread,
Jul 7, 2017, 2:31:20 PM7/7/17
to
The sed usenet is rarely frequented by sed people. I hope that I am known well enough in this usenet that I can be permitted to ask a brief, simple sed question:

In sed there are two switches I have about which I have a question:

-e

and

-f

Would someone kindly explain the difference between these two switches?

Thank you for your time and patience.

--Doc

Ben Bacarisse

unread,
Jul 7, 2017, 2:45:35 PM7/7/17
to
"Doc Trins O'Grace" <doctrin...@gmail.com> writes:

> The sed usenet is rarely frequented by sed people. I hope that I am
> known well enough in this usenet that I can be permitted to ask a
> brief, simple sed question:

comp.unix.programmer can be used for generic questions like this despite
really being about programming rather than tools. I doubt anyone would
mind.

> In sed there are two switches I have about which I have a question:
>
> -e
>
> and
>
> -f
>
> Would someone kindly explain the difference between these two
> switches?

Did the manual page not say enough:

-e script, --expression=script

add the script to the commands to be executed

-f script-file, --file=script-file

add the contents of script-file to the commands to be executed

--
Ben.

Ed Morton

unread,
Jul 7, 2017, 3:05:11 PM7/7/17
to
On 7/7/2017 1:31 PM, Doc Trins O'Grace wrote:
> The sed usenet is rarely frequented by sed people. I hope that I am known well enough in this usenet that I can be permitted to ask a brief, simple sed question:

You'd be better off posting it at https://stackoverflow.com/questions/tagged/sed.

Ed.

Kaz Kylheku

unread,
Jul 7, 2017, 3:14:14 PM7/7/17
to
On 2017-07-07, Doc Trins O'Grace <doctrin...@gmail.com> wrote:
> The sed usenet is rarely frequented by sed people. I hope that I am known well enough in this usenet that I can be permitted to ask a brief, simple sed question:
>
> In sed there are two switches I have about which I have a question:
>
> -e
>
> and
>
> -f
>
> Would someone kindly explain the difference between these two switches?

The argument to -f is the name of a sed script: a file which contains sed commands.

The argument to -e is itself a script of sed commands.

If your documentation is saying "-e script" versus "-e script-file",
you have to understand that "script" in "-e script" literally refers to
a script in the command line, not to a script file.

sed -e s/foo/bar/ # replace foo with bar

sed -f foobar # carrry out foobar script

If the file foobar contains nothing but the line

s/foo/bar

then the above two are equivalent.

Spiros Bousbouras

unread,
Jul 16, 2017, 6:11:23 PM7/16/17
to
On Fri, 07 Jul 2017 19:45:33 +0100
Ben Bacarisse <ben.u...@bsb.me.uk> wrote:
> "Doc Trins O'Grace" <doctrin...@gmail.com> writes:
>
> > The sed usenet is rarely frequented by sed people. I hope that I am
> > known well enough in this usenet that I can be permitted to ask a
> > brief, simple sed question:

Which group is "sed usenet" ?

> comp.unix.programmer can be used for generic questions like this despite
> really being about programming rather than tools. I doubt anyone would
> mind.

Even better comp.unix.shell .
0 new messages