Interview Preparation mode beta
Funny Facebook Status Funny Facebook Status
Enter your email address

Explain about Redirecting the Input in UNIX

Nice?Vote!

1 Answer

Nice?Vote!
We use the < symbol to redirect the input of a command.

The command sort alphabetically or numerically sorts a list. Type

% sort

Then type in the names of some vegetables. Press [Return] after each one.

carrot
beetroot
artichoke
^D (control d to stop)

The output will be

artichoke
beetroot
carrot

Using < you can redirect the input to come from a file rather than the keyboard. For example, to sort the list of fruit, type

% sort < biglist

and the sorted list will be output to the screen.

To output the sorted list to a file, type,

% sort < biglist > slist

Use cat to read the contents of the file slist
answered 1 year ago by siva (10,720 points)

Related questions