[Discuss] cocat for linux

Clarke Brunsdon crimson at uvic.ca
Fri Jun 9 16:03:06 PDT 2006


On Fri, 2006-06-09 at 15:46 -0700, p.willis at telus.net wrote:
> Quoting Clarke Brunsdon <crimson at uvic.ca>:
> 
> > #!/usr/bin/python
> > import sys
> > files = []
> > for file in sys.argv[1:]:
> >         files.append( open (file, 'r') );
> > haslines = 1;
> > while(haslines):
> >         haslines = 0
> >         thisline = ""
> >         for file in files:
> >                 line = file.readline()
> >                 haslines = haslines or line
> >                 thisline = thisline + " "  + line[:-1]
> >         print thisline[1:]
> > 
> > 
> > 14 lines, 2 minutes
> 
> 
> Great!
> What does it do if the files have different numbers of lines?

it partitions your hard drive.

> cocat is written in C and does error checking, has selectable delimiter.
> I do have one buffer to make resizing dynamic on though.
> 91 lines , 18 minutes (including testing) 

i bet it runs exceptionally fast




More information about the Discuss mailing list