Jeff Newmiller wrote:
> 
> On Thu, 1 Nov 2001, Michael D. Schleif wrote:
> 
> >
> > Speaking of sed scripts ;>
> >
> > How can I pass a shell variable into a sed script pattern space?
> >
> > I've seen two (2) means documented elsewhere; but, I cannot get them to
> > work in Dachstein-CD:
> >
> >       sed -n '/'"$var"'/p' file
> 
> This works...
> 
> >
> >       sed -n '/$(var)/p' file
> 
> ...but this won't because substitutions are not made inside single quotes.
> 
> >
> > Yes, I've found that I can do it this way; but, I'd prefer a single
> > step:
> >
> >       regx="/$var/p"
> >       sed -n $regx file
> >
> > What do you think?
> 
> This is a single step? :)

No, that's my point . . .

> Shouldn't
> 
>   sed -n "/$var/p"
> 
> work?

My bad -- again ;<

This just isn't my day.  I don't know what I was doing differently; but,
yes, now these work . . .

-- 

Best Regards,

mds
mds resource
888.250.3987

Dare to fix things before they break . . .

Our capacity for understanding is inversely proportional to how much we
think we know.  The more I know, the more I know I don't know . . .

_______________________________________________
Leaf-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user

Reply via email to