Mac Console paste generating trash text
-
04-07-2019 - |
Question
On mac os console, when doing paste of large quantities of text (for example an sql database) I get loads of trash and corrupted text. But when doing the same under windows or into a text box, this doesn't happen and the text comes out ok.
Is this a buffer problem or something like it? If so anyone know any flag to make its size bigger?
Other than that, anyone got any sugestiong on a way to fix this?
Solution
Don't use copy/paste. Seriously, the shell was designed a long time before the GUI; it doesn't well with certain modern HIG idioms like copy/paste. The ironic thing is that your task will probably be easier if you dump to a temporary file rather than pasting. For example, rather than doing something like this:
dump_database
# select and hit Cmd+C
create_database
# hit Cmd+V at prompt
Try something more like the following:
dump_database | create_database
Or if you absolutely must:
dump_database > tmp_file
# ...
create_database < tmp_file
rm tmp_file
Alternatively: Just use pbcopy
and pbpaste
.