Showing results for 
Search instead for 
Do you mean 

Trouble with SED

SOLVED
Go to Solution
Frequent Advisor

Trouble with SED

getting unable to parse on the following sed stmt:

sed -n '${x},${y}p' $filnam

where x=beginning line number and
y=ending line number of text in a file I'm trying to extract. Been searching manuals but no solution yet.
"Life is love and love is life"
3 REPLIES
Honored Contributor Honored Contributor

Re: Trouble with SED

Remove the single-quotes from your statement.

sed -n ${x},${y}p ${filnam}

Honored Contributor Honored Contributor

Re: Trouble with SED

Chris,

It is because the single quotes around the expression will not let the shell to expand the values of $x and $y.

Use double quotes around the expression.

sed -n "${x},${y}p" $filnam

Sundar
Learn What to do ,How to do and more importantly When to do ?
Highlighted
Frequent Advisor

Re: Trouble with SED

Thanks folks, that fixed the problem. Both your time and expertise was greatly appreciated.

Very Respectfully,
Chris Elmore
"Life is love and love is life"