LINUX CLASSES - LINUX COMMANDS
How Can I Join Files Together?
The
cat command's primary function is to concatenate, or join, files, but you can also use it to display a file on the screen. The
cat
command takes one or more files that you specify, smashes them together, and then sends the resulting file to the standard output
device (without changing any of the original files).
The standard output device is your screen, but by using the greater-than (>) operator, you can redirect
cat's output to another file.
Here are some examples:
cat food Display the food file on the screen.
cat scratch fever Join the files scratch and fever and then displayt
he result on the screen.
cat eats bird > DetailsAt11 Join the files eats and bird and save them in the file
DetailsAt11.
Note that the original files that cat joins are not modified. For example, say the file eats contained these lines:
The Owl and the Pussy-Cat went to sea
In a beautiful pea-green boat.
Also say the file bird contained these lines:
They took some honey, and plenty of money
Wrapped up in a five-pound note.
After the preceding command, neither file would change, but a new file called DetailsAt11 would be created, containing all
four lines:
The Owl and the Pussy-Cat went to sea
In a beautiful pea-green boat.
They took some honey, and plenty of money
Wrapped up in a five-pound note.
For more information on the cat command, see the
cat manual.
Previous Lesson: Printing Linux Files
Next Lesson: Searching for Files
[ RETURN TO INDEX ]
Comments - most recent first (Please feel free to answer questions posted by others!)
Eloise ( 15 Oct 2013, 03:52)
Hello there, just discovered lowfatlinux.com on Yahoo, and found that it's
really awesome. I'm gonna watch out for brussels. I will appreciate if you
keep writing about this subject in future. Lots of people will benefit from
your writing. Cheers!
ashok ( 07 Feb 2013, 09:46)
It's really a nis page to learn every thing about linux
Julie ( 13 Dec 2011, 21:02)
I would like to merge 300 .txt files the way join merges two files ie
common first column, is that possible?
Thank you
Mamdouh ( 01 Nov 2011, 07:14)
Thank you for this examples
Can this example apply to the images files?
for example, I need to join multiple images file.
Thank you for your interest
Wakslob ( 21 Oct 2011, 11:36)
Your explanations are incredible!!! Very comprehensive! I'll recommend your
site first to anyone who needs beginner advice! Thanks!
Kadiri Umar Afebgua ( 22 Jul 2011, 08:07)
I want to know how to merge different files from seismographic data, say
for instance, merging 24 different files and pql the merged files to see
the waveforms in SAC format.
Thanks.
belibossy ( 14 Jul 2011, 00:44)
good start
newbie ( 13 May 2011, 04:14)
Hello,
ich want to know, if it is possible to write a script that can merge two
files to one. That´s easy of course. The point is, in the first file i
have data and this data shoud be written to the second file but. the second
file is a finite element mesh and i want to write the data from the first
file to the second one. every note of the second file should have another
worth.
for example. node 1 = 50, node 2=30, node 3=46 an so on. I hope it is clear
what i want to tell you. My english is really bad as you can see ;-)
Thanks for your help
Joy ( 13 Jul 2010, 07:30)
Hi Bob,
Thanks a lot for providing useful tutorials. Recently in an interview I've
been asked to write a script by which;
1) I can connect a remote host through ssh with passwd,
2) go to /home directory (cd /home),
3) check the size of that directory (du -h).
I hope I'm correct for 2) & 3), however I'm clueless about 1); plz help.
hi ( 22 Apr 2010, 04:22)
Hi,
not realy, you need to make a scp tu get the file in local and then make
the cat
or make a ssh connection a make the cat on the remote machine.
kind regard
Noel McShane ( 31 Mar 2010, 04:31)
Hi
Some very good examples on cat.
Can you cat two remote files if you hvae ssh keys setup
Regards
Noel McShane
I welcome your comments. However... I am puzzled by many people
who say "Please send me the Linux tutorial." This website *is* your Linux Tutorial! Read everything here, learn
all you can, ask questions if you like. But don't ask me to send what you already have. :-)
NO SPAM! If you post garbage, it will be deleted, and you will be banned.
|
Copyright ©
by Bob Rankin
- Privacy Policy
All rights reserved - Redistribution is allowed only with permission.