I can't reproduce the behavior you describe. Your terminal emulator may have a limit on the size of paste buffers, but repeated newlines, if you really have them, sounds like a bug.
Are you sure that you're taking the shell processing into account? In a here document delimited with
<<EOF, the characters
` are interpreted by the shell as the start of a variable substitution or command substitution. So for example, if your selection contains
then pasting it followed by
EOF results in a file containing something like
To avoid these substitutions, tell the shell to interpret the here document content literally by quoting the here document marker (
cat <<'EOF' or
cat <<\EOF or
cat <<"EOF" or any other variation).
Make sure that you're pasting the selection you intend. X11 has multiple selections; old-fashioned X11 applications where copying is automatic upon selection use the PRIMARY selection, whereas new-style X11 applications with a separate copy command use the CLIPBOARD selection.
The solution to your problem is not to paste, but to use a program such as xclip or xsel to copy the selection to a file. For the PRIMARY selection:
xclip -o >/etc/configfile
xclip -o | patch
xsel | patch
For the CLIPBOARD selection, call
xclip -selection clipboard or to