My guess is as anybody's $name likely contains '/' or other characters awk
interprets.

I would start by replacing / with # in the sed command hoping that # is
never present in $name.

Like this:
sed "s#NAME_GOES_HERE#$name#" | ...

You could also use : to replace /, but that may be common in $name.

Tomas


On Tue, Jul 9, 2024, 12:52 Johnathan Mantey <[email protected]> wrote:

> If it only fails on one list, then it must be a problem with the list?
> Perhaps $name is populated with an invalid set of characters?
>
> On Tue, Jul 9, 2024 at 9:41 AM Michael Ewan <[email protected]>
> wrote:
>
> > 's' is the substitute, character 24 is the '$', I am not sure why that is
> > giving you an error, but check if $name is weird on that one msg file.
> >
> > On Tue, Jul 9, 2024 at 9:35 AM Rich Shepard <[email protected]>
> > wrote:
> >
> > > I've a short script with this sed statement:
> > > sed "s/NAME_GOES_HERE/$name/" msg | mailx -s "<title>" $addr
> > >
> > > It's applied to three lists, but on only one list does it produce this
> > > error:
> > > sed: -e expression #1, char 24: unknown option to `s'
> > >
> > > The messages go out and there's no `s' at character position 24 so I'm
> > > puzzled why I see that message.
> > >
> > > Any thoughts?
> > >
> > > Rich
> > >
> >
>

Reply via email to