E.Cross
E.Cross

Reputation: 2137

Mac ssh terminal

So I am on an old (fully aluminum) macbook pro running snow leopard and using terminal to ssh into remote hosts on my work network. I am noticing a strange thing when I copy and paste things in the terminal.

For example I will grep for something like this in a file:

samtools view sorted-616.bam | grep 'SOLEXA9:1:1:30:3316:10211' | head -n 1

and it gives

SOLEXA9:1:1:30:3316:10211 69 k26_179705 159 0 * = 159 0 TATGCCGCCAAACGCTTCCGCAAAGCTCTGTGTTTGACTATGTAGCGACTA CBCCCCCC@CCCCCCCCC?@CC?CC########################## RG:Z:1

But now when I select it, hit command+c to copy, and then command+v to paste, it comes out like this:

SOLEXA9:1:1:30:3316:1021169k26_1797051590*=1590TATGCCGCCAAACGCTTCCGCAAAGCTCTGTGTTTGACTATGTAGCGACTACBCCCCCC@CCCCCCCCC?@CC?CC##########################RG:Z:1

Notice how there are no spaces in between fields now. Is there a special method to copy and paste things exactly as they are?? Why is terminal behaving this way?

Upvotes: 0

Views: 708

Answers (2)

Mark
Mark

Reputation: 6128

What happens when you use pbcopy?

samtools view sorted-616.bam | grep 'SOLEXA9:1:1:30:3316:10211' | head -n 1 | pbcopy

This should do the same thing that the copy command does, but without having to select the output you want.

Have you tried another terminal emulator? I use iTerm2 because it will copy to the clipboard on selection without having to hit Command-c.

EDIT: You may have to install Apple's developer tools to get the pbcopy/pbpaste tools.

Upvotes: 2

Simon
Simon

Reputation: 3717

No idea why the spaces are missing from the pasted text, but I'd try to write the output to a file, open up the file in an editor and try to see if it's something other than the standard space/newline characters. You seem to know your way with piping, but anyway:

samtools view sorted-616.bam | grep 'SOLEXA9:1:1:30:3316:10211' | head -n 1 > file.txt

It might depend on which system the host is running. I have had some issues while on ssh connections to linux/unix hosts, while Mac-to-Mac usually works just fine.

Upvotes: 1

Related Questions