1752802 Members
5689 Online
108789 Solutions
New Discussion юеВ

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 3
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"