Issues in sed command

I use

SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

We have a user-defined command called "submit" which will open a vi terminal in which we need to enter the description at 24th line and save it.

In order to simplify this, i decided to create another command in which the description can be passed as an argument.

 function submit1
{
  submit|sed -ie '24 c\ "$1" ' `ls -rt /tmp/tmp.*|sed -n '1p'`
}

But it throws the below error and hangs:

Vim: Warning: Output is not to a terminal

Any thoughts on this error?

Thanks

man sed

sais that -i option modifies the input file.
But here the input is a stream!
Try withou -i ...

---------- Post updated at 05:23 AM ---------- Previous update was at 05:15 AM ----------

Just seeing that the first sed also gets arguments (from the sub command in backticks) that can be modified. I am not sure how this combination is handled...
And your error is a "vim" error, so it seems that this does not work at all.
Maybe you should write a "vim" macro instead!

Note that using sed with the -i option may change the inode of the file. Using ed with -s option wouldn't.

Trying without "-i" won't save the changes in the /tmp/tmp.* file, which is required in my case. i am exploring -s option in ed as ctsgnb suggested.

Thanks

---------- Post updated at 06:24 PM ---------- Previous update was at 05:45 PM ----------

I have tried something like below, but still it doesn't work as expected:

 function submit
{
  submit 2>&1 &
  filename=`ls -rt /tmp/tmp.*|sed -n '1p'`
  ed -- ${filename}  <<-HERE
  24s!<enter description here>!$1!
  w
  q
HERE
}

The first submit command opens vi terminal with some text . In which i need to enter the description and save it. This is what i want to accomplish, but getting the below errors:

desktop% submit test
[20] 32522
933
?
desktop%
[20]  + suspended (tty output)

Any thoughts on this?