1

Is there a better way to join files that have been splitted than just doing a "cat" or "join"? These commands just copy the file streams into a new file on disk. A much better way would be manipulating the filesystem pointers to join the files into one big continuous file. Of course this would be filesystem specific. Is there something available for ext2 or ext3?

1
  • Yes. And it makes no sense for this kind of special case to be in userspace. It would break the whole idea of the filesystem abstraction.
    – gtrak
    Jul 11, 2010 at 19:32

2 Answers 2

6

No, the correct way to split files is:

split bigfile

and conCATenate them:

cat x* > newbigfile

Trying to do this with the underlying filesystem is the wrong approach if for no other reason than it wouldn't be portable.

2
  • There are several use cases where portability is not the primary issue. Partition tools work with these kinds of issues all the time. I can't see why this shouldn't be available - at least for a root user.
    – Eddy Yosso
    Jul 12, 2010 at 9:51
  • See part of Gary's answer. Filesystem abstraction would be broken. You're catting files, not manipulating filesystems. That's the difference between split/cat and parted. The rest of the OS wouldn't have any idea why all of a sudden something weird happened to some otherwise perfectly normal files. I wouldn't run such a utility except on an unmounted filesystem. Jul 12, 2010 at 11:59
-1

Once I had one file with 2Gb and I wanted to add a file at the header of that.

I would cat a new file, but was concerned about performance.

So I ended up using "vi" on the big file and typed :read header.txt at the beginning of the file, then save it.

It worked, and faster than cat.

Maybe "vi" is clever at rewriting the file, I've never seen the code, though.

You must log in to answer this question.