Paste command: setting (multiple) delimiters

pastetext processing

In Linux, I have the following problem with paste from (GNU coreutils) 8.13:

Trying to set another delimiter than the default (TAB) results in either just printing the first character of the defined delimiter or perfectly ignoring it.

Question: How does one define (multiple) delimiters when using paste?

Simply using, e.g. abc-123 as delimiter would be nice. With "multiple" I mean e.g. 2 TABS instead of one.


The patterns enclosing the delimiter(s) I've tried so far were

  • --delimiters="\delimiter"
  • --delimiters='\delimiter'
  • --delimiters=$"\delimiter"
  • --delimiters=$'\delimiter'

All with the same result: Only the first character is accepted or perfectly ignored. I've also tried the short version -d"\" and multiple instances &ndahs; nothing.

Also:

  • --delimiters="\\" → Error message

What works perfectly, though not what I want:

  • --delimiters="\n" → newline
  • --delimiters="\0" → nothing inbetween
  • --delimiters="\t"TAB, the default. Great.

Best Answer

To have abc inbetween file1 and file2, you can do:

paste -d abc file1 /dev/null /dev/null file2

Or:

paste -d abc file1 - - file2 < /dev/null

If you want two tabs:

paste file1 /dev/null file2
Related Question