Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using parameter in sed script file ?.

Status
Not open for further replies.

mjuell

Programmer
Jun 26, 2003
17
NO
I have this file... insert.sed

10i"Hello"

It inserts a Hello on line 10..

if i export a variable $line_num

I cant use
$line_numi"Hello"


Any ideas ?
 
I guess you could use sed to modify the script before using it...

sed 's/$line_num/'$line_num/ insert.sed > insert2.sed
sed -f insert2_tmp.sed file1

...but it's a kludge, so perhaps consider using awk which allows you to pass variables to it.

 
Thanx.. Figured it out myself after som hard tinking..
My brain sometimes get's bluescreen.. :)

 
Please post Your findins so that this can be helpful to Others. I think the fun in sharing is that you don't loose what you have but gain something else..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top