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!
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: