0
votes
1answer
41 views

Redirect output to printer via device file?

Is there a way in Linux to print a file with a modern printer (a Canon MX870 in my case) by redirecting text to a device file? I imagine the command to look something like this: cat my_notes.txt ...
0
votes
2answers
184 views

How to redirect a part of stderr and stdout to /dev/null

My program outputs to stderr and stdout. I want to grep for "pattern" either in stderr and stdout. And I want the rest to be sent to /dev/null. If I pipe after redirect stderr : ./prog 2>/dev/null ...
0
votes
0answers
285 views

mysqldump to local mysql database through ssh

This command: ssh bruchowski@www.example.com 'mysqldump -u bruchowski -p dbname' > mysql -u root dbname Produces this error: mysqldump: Got error: 1045: Access denied for user ...
1
vote
1answer
63 views

Linux - Output to Folder that Yet Exists (in one command)

Is it possible to achieve this in one command without requiring a script: echo "test" > /folder/that/does/not/exist/newFile.txt
0
votes
1answer
202 views

Streaming log file contents (piping)

I am trying to understand how piping works and am stuck at this point. A log file is being streamed and its output is being piped to pigz. What I am trying to do is, redirect the pigz content to a ...
1
vote
1answer
228 views

Shell script detecting errors from command called by script

I am calling applications from my shell script, which performs a number of important steps in sequence, one step being below: for database in $( echo 'show databases;' | mysql ...
2
votes
1answer
1k views

How to redirect multiple bash commands to a variable AND screen?

I would like to capture a subshell's output in a variable and print it in the terminal screen simultaneously. Is it possible to do this by assigning the subshell to a variable and piping stdout and ...
0
votes
2answers
361 views

Linux output redirection not working with awk

I'm trying to write a nice csv-file based on some output from top. I reformat the output with awk like this: top -b | nawk '/Cpu/ || /Tasks/ { if($1 ~ /Cpu/) { printf "%s,",$3 } else { printf "\n" } ...
2
votes
1answer
639 views

Unix bidirectional pipe on commandline

I've been able to use this linux command to connect Netcat to a serial port: nc -l 80 <> /dev/ttyS0 I would like to be able to log this transaction. My backup plan is to use Wireshark to ...
3
votes
2answers
10k views

In windows, can I redirect stdout to a (named) pipe in command line?

Is there a way to redirect the standard output of a process in Win32 console to a named pipe? Named pipes are built in to Windows and while they would be an useful concept, I've never seen them used ...
1
vote
1answer
154 views

redirecting output from several piped commands

This works: find . -type f | xargs md5sum | sort This does not and gives several "md5sum: xyz not found" errors: ( find . -type f | xargs md5sum | sort ) >~/md5.txt Same for: find . -type f ...
3
votes
1answer
623 views

Linux: redirecting stdout and stderr

I want to write stdout to a file but also prints stdout and stderr. I tried using tee: prog | tee stdout.txt but this causes the printed stderr and stdout to be interleaved incorrectly, i.e. if the ...
7
votes
1answer
733 views

Is backwards redirection the same as a pipe?

In Linux if you type sort < txtfile is that the same thing as cat txtfile | sort
2
votes
4answers
2k views

How to redirect the output of a program to the linux diff command

I have a program that writes to stdout. Is there a way that I can redirect the output to the linux diff command or do I have to write the output to a file and then compare that. For example I have a ...
0
votes
3answers
311 views

Command output redirection to vim not working on OS X

I'm trying to redirect the output of a command to vim using the - argument, but it doesn't seem to work on OS X. For example, if I type $ ls | vim - on the command line on one of my Linux ...
14
votes
4answers
13k views

cURL: how to suppress strange output when redirecting?

I'm trying to print just the verbose sections of a cURL request (which are sent to stderr) from the bash shell. But when I redirect stdout like this: curl -v http://somehost/somepage > /dev/null ...
2
votes
1answer
104 views

How to construct shell redirection on command line

Consider the following command in Unix: echo 0123456789 | cat >/tmp/foo &> /tmp/bar The echo is sent to /tmp/bar. However, what I really want is to redirect the stdout and stderr output ...