Can someone tell me that how we do cut and paste in ed, for example for the following question?
Write a script for
edwhich moves all lines starting with character#to the end of the input file?
Can someone tell me that how we do cut and paste in ed, for example for the following question?
Write a script for
edwhich moves all lines starting with character#to the end of the input file?
This question is worded like a homework question. You will learn very little by having the answer given to you.
g/^#/m$
This applies the move-to-end command (m$) to all lines matching/^#/. All that is missing is to write the result back to the original file. For an extra challenge, combine this with your last question and come up with a way of commenting out line 10 through to 20 and move them to the end of the file, not touching other commented out lines.
manpage fored, trying with what you've learned, and editing your questiin with where you are having trouble if you can't get it to work. – Nasir Riley Apr 13 '18 at 19:16