Redirection (computing): Difference between revisions

Content deleted Content added
Line 113:
 
==Chained pipelines==
The redirection and piping tokens can be chained together to create complex commands. For example, <syntaxhighlight lang="bash" inline>sort infile | uniq -c | sort -n > outfile</syntaxhighlight> sorts the lines of {{mono|infile}} in lexicographical order, writes unique lines prefixed by the number of occurrences, sorts the resultant output numerically, and places the final output in {{mono|outfile}}.<ref>https://www.linux.org/threads/piping-and-redirecting-output-in-the-linux-terminal.43745/</ref> This type of construction is used very commonly in [[shell script]]s and [[batch file]]s.
 
==Redirect to multiple outputs==