Combine Text Files Using cat Command

English

Combine text files using cat command.

Below you will find some examples that will help you to understand the correct use of the CAT command, to combine and merge text files.

Combine text files using cat command.

The merged text can then be stored in another text file.

First example:

Open a terminal window and type the following command:

cat file1.txt file2.txt file3.txt

Press Enter.

This will print out three text files in a single merged output.

Second example: Merging text from three files to another text file.

cat file1.txt file2.txt file3.txt > file4.txt

This will store the content of the three textfiles into a another text file.

Third example: Merging text from three files, and saving the output to another file in alphabetical order.

cat file1.txt file2.txt file3.txt | sort > file4.txt

Press Enter.

Fourth example: Appending text from the terminal window directly to a file.

cat >> textfile.txt

Press Enter.

After entering this command, a cursor will appear for you to enter the text you want to add to the specified file.

Enter the text and press Ctrl+D.

Note: Your entered text will be appended at the end of the file.

Games For Linux

Windows has always been the preferred platform for gaming, but after STEAM's interest in Linux more game developers are making their games natively available for Linux.

Disclaimer

All information on this website is published in good faith and for general educational purposes and for use in safe testing environments only. While linuxexperten.com strives to make the information on this site as accurate as possible, linuxexperten.com does not warrant its completeness, reliability and accuracy.

We are not responsible for any losses or damages associated with the use of our website. While we strive to provide only links to useful websites, we have no control over the content of these sites and links to other sites do not constitute a recommendation for all content contained on these websites.

 

Site Information

This is a professional review site that receives compensation from the companies whose products reviewed. Each service or product are thoroughly tested and given high marks if considered to be the very best. Independently owned and the opinions expressed here are no one elses.

 

Limited Time Offers

Coming soon...