The stdout tag has no wiki summary.
0
votes
2answers
137 views
Redirecting stdin with stdout to file
So I have a program that takes in user input and outputs text based on the input.
EDIT2: I want to create a script that runs a C executable and the script feeds the C program input from a file and ...
2
votes
3answers
100 views
Output to stdout and at the same time grep into a file
I have a script that outputs text to stdout. I want to see all this output in my terminal, and at the same time I want to filter some lines and save them in a file. Example:
$ myscript
Line A
Line B
...
8
votes
1answer
119 views
Output of command not in stderr nor stdout
I've stumbled on this issue, so I'm wondering how is this possible?
Standard run of command:
# zabbix_sender -c zabbix_agentd.conf -k mmysql.QCInserts -o 14
info from server: "Processed 0 Failed 1 ...
3
votes
2answers
80 views
Read data from a pipe for a certain amount of time (in seconds)
Is there an easy way to create a pipe that only lasts for a given amount of wall time?
I want to be able to take a "snapshot" of what's being written STDOUT for a period of time (rather than bytes or ...
2
votes
2answers
46 views
redirecting std output and std error
I have been trying to figure out the relationship between file descriptors. One thing I don't understand is, how is:
ls -l /bin/usr > ls-output.txt 2>&1
different from:
ls -l /bin/usr ...
1
vote
2answers
52 views
Turning standard output hyphen into a single command
I am working with scripts that output xml and I am using xmllint to format the output. Xmllint requires a source argument, so I use the hyphen to pipe standard output to it:
$> script.php ...
5
votes
1answer
33 views
IO and other shell commands when a program is not started by a terminal
I have several launchers on my desktop for various programs, and there is a "run in a terminal" setting for those launchers.
When I check that setting, the program runs from a terminal, and logs its ...
2
votes
2answers
95 views
Tail -f piped through grep not outputing to file, but outputs to console
I'm using the following command
tail -f /mydir/myfile | grep "searchterm" >> outfile
Without the -f it works fine, but with the -f, which I need, nothing is written to the file. The ...
4
votes
2answers
188 views
GNU screen: print a detached session to stdout
I just want to have a quick overview of my detached GNU screen sessions. Is it possible to dump the current content to stdout ? Something like
screen --print SESSION_NAME > file.txt
4
votes
1answer
303 views
Ksh loses data after piping 16K bytes
I recently found that ksh may lose some data after printing more than 16K bytes to the stdout if it is blocked for a couple of seconds.
This test.sh script prints out 257*64 (16448) bytes:
...
1
vote
3answers
149 views
grep how to suppress display of non-matched file?
I am trying to find files containing a specific word using grep. There are many files in the directory (> 500)
Command I run
$ grep 'delete' *
Output
validate_data_stage1:0
validate_data_stage2:0
...
1
vote
1answer
552 views
How can I get vsftpd version into shell variable?
I want to get vsftpd version into shell variable. I can get it to console with ease:
# vsftpd -version
vsftpd: version 2.2.2
Also I can get a lot of other info into variable:
# i=`bash --version ...
0
votes
2answers
100 views
sudo: script launched from another script won't redirect standard output
I'm using AIX 5.3 with sudo 1.6.9p23. Sudoers file grants user fcomartin permission to run any command as user oas:
fcomarti ALL=(oas) ALL
User oas has a bash script called menu, which launches ...
7
votes
2answers
175 views
How a piped shell programs balance their output/input rates? [duplicate]
Possible Duplicate:
Bash while loop and reading from pipe
I come from web programming background, and find myself interested in one peculiarity of using a local shell. I understand that ...
2
votes
2answers
421 views
How to redirect error to a file?
I have this simple script which redirects the output and append it to a file.
filename="/home/ronnie/tmp/hello"
date=$(date)
echo "$date" >> $filename
Now, lets suppose I change date=$(date) ...
1
vote
2answers
117 views
Redirecting tr stdout to a file [duplicate]
Possible Duplicate:
How can I make iconv replace the input file with the converted output?
Can I read and write to the same file in Linux without overwriting it?
$ cat test.txt
This is a ...
3
votes
1answer
169 views
limit stdout to terminal output speed [duplicate]
Possible Duplicate:
How can I limit the output speed of stdout?
What's the easiest way to limit the speed at which stdout is output in a terminal, so that, for instance, tail -f outputs ...
3
votes
3answers
468 views
How do I make python programs behave like proper unix tools?
I have a few Python scripts laying around, and I'm working on rewriting them. I have the same problem with all of them.
It's not obvious to me how to write the programs so that they behave like ...
3
votes
2answers
456 views
Merge two command results to one line when redirecting stdout
In a cron script I want to log CPU temperatures in the format
[datetime] temp
using date and acpi -t. How can I redirect (>>) these two commands to a single line in the log file?
3
votes
2answers
563 views
Output file contents while they change
I want to output a file's contents while they change, for example if I have the file foobar and I do:
magic_command foobar
The current terminal should display the file's contents and wait until, I ...
10
votes
2answers
432 views
Redirect stderr from an already running script
I've been running a script for several days now. I redirected stdout to $HOME/mylog, but didn't redirect stderr since I thought there would be nothing on it. Suddenly thousands of lines started coming ...
3
votes
1answer
181 views
Append output to a file and redirect stderr to null
How can I append the result of a command to a file and redirect stderr to null?
17
votes
3answers
2k views
How to do nothing forever in an elegant way?
I have a program which produces useful information on stdout but also reads from stdin. I want to redirect its standard output to a file without providing anything on standard input. So far, so good: ...
4
votes
1answer
139 views
Discard stdout of a command for t seconds
I am working on some batch scripts involving the following:
Run some non-terminating sub-processes (asynchronously)
Wait for t seconds
Perform other task X for some time
Terminate subprocesses
...
5
votes
2answers
412 views
Wrapping a shell script with tee
There is a bash script which prints some logs and allows some arguments. The script prints the logs to STDOUT.
Let's say the script's name is AAA.sh
I'd also like to make the script to print the logs ...
5
votes
2answers
470 views
Why does `cat`ing a file into itself erase it? [duplicate]
Possible Duplicate:
IO redirection and the head command
I just wanted to remove all but the first line of a file. I did this:
head -1 foo.txt
... and verified that I saw only the first ...
3
votes
1answer
147 views
Supress startup messages on stdout?
I'm using tcsh, and have to source a group .cshrc file. This file echoes some messages, which is fine for normal shells, but causes problems with programs like scp and rsync. I can see the solution ...
5
votes
2answers
1k views
Execute command in remote active terminal
Suppose you have a terminal emulator (T1) open with a PID of 6350.
From another terminal, type this command (C1):
echo "ls\n" > /proc/6350/fd/0
This writes ls and the new line in T1 but does ...
5
votes
3answers
2k views
bash: /dev/stderr: Permission denied
After upgrading to a new release version, my bash scripts start spitting errors:
bash: /dev/stderr: Permission denied
in previous versions Bash would internally recognize those file names (which is ...
2
votes
2answers
321 views
Can I read and write to the same file in Linux without overwriting it? [duplicate]
Possible Duplicate:
How can I make iconv replace the input file with the converted output?
I frequently connect to amazon ec2 using their public DNS names ...
1
vote
1answer
113 views
How to see output of a running program over ssh
I use debian 6 on an embedded system which is supposed to run a program called pilot. The OS is configured to login as root without asking password (there is no monitor nor keyboard connected). After ...
3
votes
1answer
281 views
Redirecting/grep'ing an existing shell's STDOUT
I run a lot of long running processes (simulations) that print progress to STDOUT. I occasionally forget to redirect to STDOUT to a file I can grep, and it's usually too far along to restart.
...
24
votes
3answers
3k views
Can I pipe stdout on one server to stdin on another server?
stdout on one CentOS server needs to be piped to stdin on another CentOS server. Is this possible?
Update
ScottPack, MikeyB and jofel all have valid answers. I awarded the answer to Scott because, ...
19
votes
3answers
534 views
How can I limit the output speed of stdout?
I'm running CentOS 5.7 and I have a backup utility that has the option of dumping its backup file to stdout. The backup file is rather large (multiple gigabytes). The target is an SSHFS filesystem. To ...
5
votes
2answers
487 views
Why jobs aren't killed at logout when executed with “> /dev/null 2>&1 &”?
When you run jobs like the example below, they're killed when you logout:
$ ./job.sh &
However, when you execute them as in the below example, redirecting stdout to /dev/null and stderr to ...
3
votes
1answer
269 views
Shell script doesn't paint last line of stdout to screen without user input
I have a shell script that's happily doing all my backup process and writing progress to stderr and stdout, with one exception — the last line doesn't get written to my terminal (if I call the script ...
1
vote
1answer
181 views
selective stdout , stderr and logging using the script command [duplicate]
Possible Duplicate:
Show only stderr on screen but write both stdout and stderr to file
stdout , stderr and logging using the script command
cat test.sh:
rm -v foo.tmp
date
pwd
cat ...
1
vote
2answers
250 views
stdout , stderr and logging using the script command
I have remove.sh which contains:
rm -v test.tmp
And I have install.sh which contains:
script remove.log -c './remove.sh'
What can I do so that whether or not test.tmp exists, I don't see any rm ...
5
votes
2answers
2k views
what is meant by connecting STDOUT and STDIN?
This is a newbie question. I'm reading a book, it says:
Every process has at least three communication channels available to it: “standard
input” (STDIN), “standard output” (STDOUT), and ...
1
vote
4answers
1k views
Can I access Nth line number of standard output?
Assuming a script that outputs a list of files:
$> bash someScript.sh
path/to/some/file
path/to/the/file/i/want/to/work/with
path/to/yet/another/file
Now I want to have the second file-path as ...
7
votes
3answers
2k views
bash: Use a variable to store stderr|stdout redirection
Is there any way to redirect stdout and stderr via variable like adding command options in script?
For example I have a script:
#!/bin/bash -x
TEST=">/dev/null 2>&1"
OPT='-p -v'
mkdir $OPT ...
1
vote
2answers
681 views
routing wget --recursive to stdout (as in -O -) rather than a file
I want to "scan" a website content, recursively, and pipe it to another program.
When I run:
wget -r -O - $SITE
I get
WARNING: combining -O with -r or -p will mean that all downloaded content
...
4
votes
1answer
1k views
Writing to stdout except for output redirection C
I have to make a simple app for school.
I have to write arguments one per line on the terminal, and return on stdout the user choices.
For example, I write cat my_app main.c main.h, if the user ...
1
vote
1answer
54 views
Can I use tail with a file both as input and destination?
I have a log file that gets big fast. I tried using tail with this syntax but it didn't work.
tail logfile.log -n 100000 > logfile.log
The output file is 0 bytes and blank. What am I doing ...
1
vote
4answers
815 views
How to limit the number of lines a command's output has available in bash?
I started downloading a big file in the background using
$ nohup wget http://example.tld/big.iso &
which also gives me a nohup.out file that includes the output of wget.
Now, if I later want ...
8
votes
3answers
234 views
Is there a way to execute a native binary from a pipe?
echo 'main(){}' | gcc -xc - -o /dev/stdout | ???
Is there a way to run the output binary on a unix-like system?
EDIT: I needed it to run the output of g++ in a sandboxed environment where I can't ...
4
votes
4answers
213 views
How to send stderr to stdout with a pipe to another command?
I'm trying to capture all of the output of a build operation, and send it to myprogram. I seem to only be able to capture part of it. This is what I'm trying:
make clean && make ...
1
vote
5answers
609 views
Display output to console while grep is used
In vim I use the following command to compile a tex file:
pdflatex\ \-file\-line\-error\ \-shell\-escape\ \-interaction=nonstopmode\ $*\\\|\ grep\ \-P\ ':\\d{1,5}:\ '
this works in terms of getting ...
0
votes
1answer
159 views
Printing file content with grep
Is it possible to print to the console all file content using only grep command? (wihtout cat, less, echo, more...)
5
votes
1answer
275 views
Is it possible to “fork” STDOUT to two different locations? [duplicate]
Possible Duplicate:
Is there a way in bash to redirect output and still have it go to stdout?
Let's say I do:
ps -ef | grep httpd
to see if apache is running or not, but I also want to ...