0

I am running one Linux command that throws few errors and warning and few other expected correct outputs. I want to move those errors and warnings to different file and rest output to different file.

I know how we can Redirect both standard output and standard error to same file, but not sure about how to redirect to different file

pravin kumar
  • 33
  • 1
  • 7
  • `command > stdout.txt 2> stderr.txt` – Ted Lyngmo Jul 19 '22 at 09:09
  • @BrianAgnew no it is only redirecting output to file and error on screen – pravin kumar Jul 19 '22 at 09:17
  • @TedLyngmo no it is only redirecting output to file and error on screen – pravin kumar Jul 19 '22 at 09:18
  • when i am addin that command in a shell script and running the script as "sh test.sh 2>errorlog" it is running as expected, redirecting error to errorlog .. But i want that single command to do the above without putting into a script – pravin kumar Jul 19 '22 at 09:21
  • Please show `test.sh` - if it opens `/dev/tty` or similar to write directly to the terminal, redirecting `stdout` from the outside won't help. If `test.sh` looks [like this](https://pastebin.com/u0mi0P7u) my suggestion will surely work – Ted Lyngmo Jul 19 '22 at 09:28

0 Answers0