What does the command “ $who | sort ‚logfile > newfile‚do?

The input from a pipe can be combined with the input from a file . The trick is to use the special symbol “-“ (a hyphen) for those commands that recognize the hyphen as std input.In the above command the output from who becomes the std input to sort , meanwhile sort opens the file logfile, the contents of this file is sorted together with the output of who (rep by the hyphen) and the sorted output is redirected to the file newfile.

Showing Answers 1 - 4 of 4 Answers

Sharif!

  • Nov 1st, 2006
 

Above ans is correct.. Output of who is added with contents of logfile. u get final output in newfile.

  Was this answer useful?  Yes

Aruna krishnan

  • Jan 23rd, 2007
 

In which shell does this command work?

  Was this answer useful?  Yes

ajay

  • Jul 25th, 2007
 

Actually the command is who |sort - logfile >newfile
there should be a space between - and logfile.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions