I am writing a bourne shell script in Linux, and I am using ed to append text to the end of the file. I MUST use ed to do this task.
What I need the appended text to look like is this
Modified on: current_date
Where current_date is the output of the date command
The code I am using is this:
ed -s $arg << END
a
Modified on: !date
.
w $arg
q
END
Clearly though, this would just put the string "!date" instead of the output of the date command.
What is the best way to accomplish this goal?
So far, I have tried to use the commands '(.,.)s /RE/REPLACEMENT/', x, and j to no avail, and I'm not seeing a command that would be able to do this in the info page for ed.