Simpler Navigation for Servers and Operating Systems
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble with SED

SOLVED
Go to solution
Chris Elmore
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
Highlighted
Patrick Wallek
Honored Contributor
Solution

Re: Trouble with SED

Remove the single-quotes from your statement.

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

Sundar_7
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 ?
Chris Elmore
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"