Gentoo Archives: gentoo-user

From: Zhang Weiwu <zhangweiwu@××××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] join two tab-separate-value files without join field
Date: Sat, 24 May 2008 04:19:07
Message-Id: 48379714.5060605@realss.com
1 Hi.
2
3 I got a datasheet from my colleague in MS Excel format and I intend to
4 process that file with my awk/sed knowledge. The problem is: he sent me
5 two Excel files each with 2134 records, in fact there should be only one
6 excel file with 2134 rows and 295 columns, but MS Excel can only handle
7 256 data columns, so he split the datasheet vertically so he can manage
8 to send to me.
9
10 Now I saved both file to tab-separated-value format, how do I join them?
11
12 I could have used join(1) but that require a join field, an ID of some
13 sort. I think of this:
14
15 $ grep -n '' left.tsv | sed 's/:/\t/'> left.forjoin
16 $ grep -n '' right.tsv | sed 's/:/\t/'> right.forjoin
17 $ join -t " " left.forjoin right.forjoin > result.tsv
18 (note that for join's -t parameter somehow I need to manage to get a tab
19 between the quotes)
20
21 Yes I achieved what I want, but that looks complex. Is there a simpler
22 way? Thanks in advance.
23
24 I know OpenOffice 3.0 can handle up to 1024 data columns. It's difficult
25 to convince anyone to switch to OOO because here in China MS Office
26 costs only 0$. I also could use OOO3.0 for doing the join but I wish to
27 know the commandline way:)
28
29 --
30
31 Real Softservice
32
33 Huateng Tower, Unit 1788
34 Jia 302 3rd area of Jinsong, Chao Yang
35
36 Tel: +86 (10) 8773 0650 ext 603
37 Mobile: 135 9950 2413
38 http://www.realss.com
39
40 --
41 gentoo-user@l.g.o mailing list

Replies

Subject Author
Re: [gentoo-user] join two tab-separate-value files without join field Tim <root@×××××××××××××××.com>
Re: [gentoo-user] join two tab-separate-value files without join field Etaoin Shrdlu <shrdlu@×××××××××××××.org>