Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi,
Is there any way to combine a number of files into one, by means of creating some kind of reference file or link? Is there any single command to accomplish this? Thanks for help in advance.
If you want to append a group of files to each other, look at the command cat.
If you want to put a number of files into an archive, use tar or zip.
From your question, it looks like what you are wanting to do is to create a soft reference to a number of files, i.e. a file containing the filenames of the various files you want to link to. The easiest way to achieve this would be to use a plain text (or even XML) document containing the filenames — but that rather depends on how you want to use it.
If a program accepts multiple filenames on the command-line, then you can also use filename globbing; e.g:
Code:
ls t*a?.dat
would list all files starting with t, and ending in a?.dat (where ? is any character).
I rather meant a method of concatenating files so that they APPEAR (from file system point of view) as regular file, while being only link to other files.
The point is not to use 'cat' or whatever else to create a new file.
Originally posted by andresv I'm trying to concatenate two files but the output is not the one that one would expect
you have two files
one
Code:
Hello W
two
Code:
orld
then execute
Code:
cat one two >> three
then, result is
three
Code:
Hello W
orld
And what I want is "Hello World" (without the CR)
Can somebody tell me what I'm doing wrong?
Is there another way of joining files? (with coreutils)
Is 'cat' binary-safe?
Thanks for the help.
It looks like you have a newline at the end of the one file. (Some text editors add newlines for you). You didn't say how you generated the one and two files, but here's one way to do this example properly:
Code:
echo -n "Hello W" > one
echo -n "orld" > two
cat one two
Without the -n option, echo adds a newline to the end of its output.
cat is the lowest level core utility to catenate files. It is completely binary safe. It stops at the end of the file or stream, regardless of the EOF character, and does not mangle any permitation of CR and LF characters. (But the virtual terminal does, in case that's confusing you.)
Thanks *rjlee* ... I was using cat >> one to create the file ...
And now with 'echo' works
My "real" problem is the next ...
I'm downloading iso images from an Internet Coffee ... they run win so can't use 'split' to chop the files in small pieces (to carry in my 256 MiB flash) so... i use a small program called 'Hacha' ( hacha.org ) -hacha stands for axe in spanish- but when I join the files with 'cat' they don't work I think Hacha write his own data in the pieces... (you can join with hacha too).
The question will be ... someone knows a win software that do the same that 'split' in *nix ... googling I found that "GNU utilities for Win32" ( unxutils.sf.net ) let's see if it works the next time I visit the Coffee
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.