Incomplete paste in a file (using cat) when copy selection from terminal

373 views Asked by At

I am trying to copy output from the Mobaxterm terminal in a file in Ubuntu 20.4 running on Win 10 - WSL 2. Steps I perform:

  1. I select the lines I want to copy.
  2. cat > file
  3. Paste (with Middle-Click, Shift-Ins, Right click menu & Paste)
  4. Ctrl-D to finish the input for the cat command

The result are not complete/reliable. I created several files using different copy&paste methods and the files obtained has different sizes (even when using the same method). See bellow:

wc AftnRG.trace.log.*
   233   1704  13751 AftnRG.trace.log.console
   233   1819  14570 AftnRG.trace.log.consoleMc
   233   1734  13940 AftnRG.trace.log.consoleMcCc
   233   1689  13625 AftnRG.trace.log.consoleMcCd
   233   1759  14129 AftnRG.trace.log.consoleMcCd2
   233   1749  14066 AftnRG.trace.log.consoleMp
   233   1713  13814 AftnRG.trace.log.consoleSi
   234   1756  14134 AftnRG.trace.log.consolecp
   233   1704  13688 AftnRG.trace.log.consolesi

Legend: Mc - middle click, Mp - Menu Paste, Si - shift Insert, Cp - menu Copy Paste, Cd - Ctrl-D , Cc - Ctrl-C

The paste looks complete but data in the file is not.

What am I doing wrong?

How to obtain the data from the clipboard complete in a file?

P.S. I remeber a similar situation when using ssh between RedHat native machines.

1

There are 1 answers

0
Claudiu Cruceanu On

At the question how to obtain complete data, I found that using vim, paste and save in a file, there were no lost of information. It is still unclear why cat is not working as expected.