Combining text files into one file

cat file1 ... fileN > combinedFile;
the last person who posted used the most roundabout way to concatinate files, there's a reason there's a "conCATinate" command... Using this method, you also get to choose the order of the files, below another person just did *.txt > combined.txt which is fine but the order depends on the implementation of "cat" which is probably alphabetical order of filenames.
Sample Output
$cat stdHeader tableOfContents introduction body conclusion worksCited index  > researchPaper
$pwd; ls;
body                conclusion                index
introduction        researchPaper             stdHeader
tableOfContents     worksCited

2010-04-17 01:00:04

2 Alternatives + Submit Alt

What Others Think

The order of the arguments depends on how the *shell*, not cat, expands the asterisk "globbing" operator. The exact order is specified in the bash manpage.
bwoodacre · 643 weeks ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: