You are not logged in.
Pages: 1
Im trying to do a few task involving redirection of linux. I am using fedora linux, it that matters. These are the task that I am trying to accomplish:
1) redirect results of a command to a text file then also redirect to another command
2) redirect input from a text file to a command
3) append result of a command to a text file without destroying the contents
4) redirect error message of a command to a text file
5) suppress the error message from a command
I really appreciate any help I can get
Offline
(All of these are specific to bash.)
1)
$ /path/to/command | tee /path/to/file | /path/to/other/command
2)
$ /path/to/command < /path/to/input/file
3)
$ /path/to/command >> /path/to/output/file
4)
$ /path/to/command 2> /path/to/error/file
5)
$ /path/to/command 2> /dev/null
Note that ">" and "2>" can be combined on a single command. You can also redirect both stdout and stderr using "@>". You're probably best off reading the "REDIRECTION" part of the bash manpage.
Last edited by tam1138 (2008-04-27 18:25:51)
Offline
wow, this is really helpful, yea I will check man thanks. I think I might have mistyped number 1). What I meant to say was redirect results of a command to a text file. Then try to do that same function but redirect result to another command. Im kinda new but I believe it would be this:
$ /path/to/command | /path/to/other/command
^^^ code to redirect results of command to another command
this was going off what you posted, correct me if Im wrong
Offline
Ah.
Redirect command output to text file:
$ /path/to/command > /path/to/file
Redirect command output to another command's input (which is to say "you're right"):
$ /path/to/command | /path/to/other/command
Simultaneously redirect command output to file and to another command's input:
$ /path/to/command | tee /path/to/file | /path/to/other/command
Also, welcome to Arch!
Last edited by tam1138 (2008-04-27 19:09:36)
Offline
Pages: 1