|
[Next] [Previous] [Up] [Top] [Contents]
CHAPTER 6 Special Unix Features 6.2 File RedirectionOutput redirection takes the output of a command and places it into a named file. Input redirection reads the file as input to the command. The following table summarizes the redirection options.
An example of output redirection is: cat file1 file2 > file3 The above command concatenates file1 then file2 and redirects (sends) the output to file3. If file3 doesn't already exist it is created. If it does exist it will either be truncated to zero length before the new contents are inserted, or the command will be rejected, if the noclobber option of the csh is set. (See the csh in Chapter 4). The original files, file1 and file2, remain intact as separate entities. Output is appended to a file in the form: cat file1 >> file2 This command appends the contents of file1 to the end of what already exists in file2. (Does not overwrite file2). Input is redirected from a file in the form: program < file
This command takes the input for program
To pipe output to another command command | command This command makes the output of the first command the input of the second command.
Introduction to Unix - 14 AUG 1996 [Next] [Previous] [Up] [Top] [Contents]
|