hhh
hhh

Reputation: 52820

Unix: how to have delimiter as "\t&\t" in paste-tool?

Results are in clean files. I want to get them to latex-table format with paste.

  1. So how can I have a delimiter "\t&\t"?
  2. or is there some Latex tool?

Pasting Columnwise to have \t&\t delimiter

$ paste -d'\t\&\t' d d_powered_-2 rad
5.0 400.0&384.5
7.5 204.1&184.5
10.0        100.0&115.5
15.0        44.4&58.2
20.0        25.0&45.0
25.0        16.0&38.8
30.0        11.1&33.3
35.0        8.2&34.4
37.0        7.3&34.1
40.0        6.2&34.1
$ paste d d_powered_-2 rad
5.0         400.0   384.5
7.5         204.1   184.5
10.0        100.0   115.5
15.0        44.4    58.2
20.0        25.0    45.0
25.0        16.0    38.8
30.0        11.1    33.3
35.0        8.2     34.4
37.0        7.3     34.1
40.0        6.2     34.1

Upvotes: 2

Views: 502

Answers (2)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798536

paste takes the argument after -d and cycles through the individual characters, using each as separators in turn. You will either need to postprocess or use a different tool such as awk.

Upvotes: 1

pixelbeat
pixelbeat

Reputation: 31708

How about postprocessing?

paste ... | sed 's/\t/\t\&\t/g'

Upvotes: 2

Related Questions