In addition to the βUse temporary fileβ option provided in user3035772 comment , another option would be to use the shell history for this.
Assuming the command that creates the output is a shell command (or you can be sure that its output is just the command you want to run later), you can use history -s to store the command in history, and then call it on on the command line to edit it (or use fc ).
history -s 'echo whatever you "want your" command to be'
Then use fc to edit it in $EDITOR or press the up arrow or Ctrl-p to load the history item into the current input line.
source share