Appending standard output to a file

To append the standard output from a command to a file use two >> (greater than) symbols followed by the name of the file. If the file does not exist it is created. For example:

   cat part1 > chapt2
   cat part2 >> chapt2

This creates a file called chapt2 with the same contents as part1. It then reads the contents of part2 and appends them to the file chapt2. The file chapt2 now contains the data from part1 followed by the data from part2.


[Home] [Search] [Index] This site maintained by staff@stacken.kth.se