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? :)
Shouldn't
sed -n "/$var/p"
work?
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<[EMAIL PROTECTED]> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...2k
---------------------------------------------------------------------------
_______________________________________________
Leaf-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user