On Thu, 3 Jan 2008 09:42:54 -0800 (PST),
prabato@gmail.com wrote:
> I need sed to delete line 130 and then replace it with the $shell_var
>
> sed -e '130s/ d'
> ^^^ doesn't work
>
> sed -e '130i/$shell_var/'
> ^^^ doesn't work
sed "130s/.*/$shell_var/"
assuming $shell_var doesn't contain any /, \, & or newline
character.
awk -v repl="$shell_var" 'NR == 130 {$0 = repl} {print}'
assuming $shell_var doesn contain \ characters.
Or
sed "130!b
i\\
$shell_var
d"
assuming $shell_var doesn't contain \ or newline characters.
--
Stephane