input and output redirection

The following example combines input and output redirection. The file text.txt is first checked for spelling mistakes, and the output is redirected to an error log file:

#spell error.log

Output of one command can be piped into another command virtually as many times as you want, just as long as these commands would normally read input from standard input and write output to the standard output. Sometimes they don’t, but then there may be special options that instruct these commands to behave according to the standard definition.

$ less –help | grep -i examine > examine-files-in-less

:$ cat examine-files-in-less
:e [file] Examine a new file.
:n * Examine the (N-th) next file from the command line.
:p * Examine the (N-th) previous file from the command line.
:x * Examine the first (or N-th) file from the command line.
+cmd Execute the less cmd each time a new file is examined.

Make sure you don’t use names of existing files that you still need. Redirecting output to existing files will replace the content of those files.

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.