Output Redirection Assignment Help

Assignment Help: >> Working with Pipes and Filters - Output Redirection

Output Redirection

Under the UNIX system, the output from a command commonly intended for standard output can be simply diverted to a file. This capability is called as output redirection.

Syntax

command > filename

The above format denotes in which the command is being diverted to a file filename using a > sign. Consider the names of the logged_in_users have to be stored inside a file names.

# who > names

In the given example, the who command gets executed and instead of writing the output to the standard output (terminal), the output is being written to the file names.

If a command redirects its output to a file or the file already hold few data then which data is lost and the new data is overwritten.

The existing contents can be retained as display below:

# echo Hi, Good Morning > salute

# cat salute

Hi, Good Morning

# echo Hi, Good Evening >> salute

# cat salute

Hi, Good Morning

Hi, Good Evening

Another echo command uses a various type of redirection symbol like >> (double greater than) sign. This double greater sign causes the standard output from the command to be appended to the specified file. Thus, the previous contents of the file are not lost and the new output is easily added onto the end of the first.

Note: In the output redirection, the stdout can be made explicit through preceding the > through the number 1, that is the file descriptor for stdout that is ( # echo Hi, Good Morning 1> salute)

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd