Post B7iv6q3zT0a8bblpjM by ed1conf@bsd.network
(DIR) More posts by ed1conf@bsd.network
(DIR) Post #B7iuzNR1VatpmxzBqq by ed1conf@bsd.network
0 likes, 0 repeats
@tusharhero Indeed, GNU ed(1) has x and y commands to copy/paste sections between files.If you're not using GNU ed, you can take note of the ranges you want and do things like$ ed file1.txt 3141 /Start/;/End/ w /tmp/scratch e file2.txt 1415 15 r /tmp/scratchor things likeed file2.txt 1415 15 r !sed -n '/Begin/,/End/p' filee1.txt 2 r !sed -n '3,5p' just_lines_3-5_please.txt
(DIR) Post #B7iv6q3zT0a8bblpjM by ed1conf@bsd.network
0 likes, 0 repeats
@tusharhero Another option is to use an external clipboard such as the X clipboard or tmux buffer:$ ed file1.txt 3141/Start/;/End/ w !xsel -ib e file2.txt 1415 15 r !xsel -obor$ ed file1.txt3141/Start/;/End/w !tmux loadb - e file2.txt 1415 15 r !tmux showb
(DIR) Post #B7izYCby8pe4Aky1se by ed1conf@bsd.network
1 likes, 1 repeats
@tusharhero Testing here too, it does seem that GNU ed doesn't preserve the yank-buffer contents across e commands. All the more reason not to rely on GNU-specific functionality :flan_wink:
(DIR) Post #B7jW7N84E3q7SenLMW by ed1conf@bsd.network
0 likes, 0 repeats
@tusharhero From Antonio (the maintainer) when I reported it to the bugs mailing list:"The cut/copy/yank buffer was not designed to copy lines between files. The buffer is a linked list of line pointers to lines in the current buffer, and is deallocated when a new file is loaded.I'll document in the manual that the cut buffer is deleted before a new file is read."