3

I would like to join about 100 files in the same directory column-wise. I have tried

  paste file1 file2 | column -s $'\t' -t

This works fine for 2 files. But when I try to do it for 100 files, I get an error saying

 column: line too long

Could someone please help where I am going wrong?

  • Can you use column -c[num] instead of using -t and paste? Or some combination thereof? – mikeserv Jun 22 '14 at 22:51
  • @mikeserv: Thank you. Could you please let me know if there are unequal number of rows, how does paste function work here? – biobudhan Jun 23 '14 at 11:31
  • I don't know - I don't have your files. – mikeserv Jun 23 '14 at 11:39
  • @mikeserv: I am asking in general how does the paste function work for unequal number of rows – biobudhan Jun 23 '14 at 12:04
  • You know, that could make a very good question on its own - why not ask it? Hope @StephaneChazelas sees it. Here's a hopeful nudge for my part. Sorry I couldn't be of more help here. – mikeserv Jun 23 '14 at 12:46
4

You don't have any errors. It's the limit of input line length, in bytes, define by column.

#define MAXLINELEN  (LINE_MAX + 1)

LINE_MAX is defined in posix2_lim.h, part of GNU C library:

/* The maximum length, in bytes, of an input line.  */                          
#define _POSIX2_LINE_MAX        2048
.....
#ifndef LINE_MAX                                                                
#define LINE_MAX        _POSIX2_LINE_MAX

Note

  • Thanks @Gnouc. How do I now go about doing the required task? I am new to unix. Please help – biobudhan Jun 22 '14 at 12:01
  • @biobudhan: You can recompile column with no limits MAXLINELEN but I think it not a good point. – cuonglm Jun 22 '14 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.