Debian Programming :: Stdout Piped To Awk -> Terminal Output Stutters

May 5, 2013

I'm piping stdout from mplayer to awk, but the output stutters.

Code: Select allmplayer audiofile.m4a 2>&1 | awk -vRS="
" '$1 ~ /A:/ {print $0; fflush();}'

Instead of a steady output of lines to the terminal, output only occurs after a few seconds, between 6 or 12. This happens whether the input is from mplayer or avconv/ffmpeg. This never used to happen (a few years ago) so I wondered whether an awk update caused this to happen.

View 6 Replies


Programming :: Pipe Output To 2 Files But Not STDOUT?

Mar 24, 2011

I want to have the output of a program go to 2 different files but not going to standard out. Is there a way to do this in bash? I know that in Z shell its really easy. omething like: Code: echo "test" >> file1 >> file2 Would work. But in Bash it doesn't seem that easy. I know that tee will send the output to 2 files but it also sends it to STDOUT.Something like:Code: echo "test" | tee -a file1 file2 Would put the word "test" in file1, file2, and STDOUT. Is there a way to just send the output to file1 and file2?

View 2 Replies View Related

Programming :: Expect: Prevent Output From Spawned Process To Appear On Stdout?

Jul 3, 2009

I have this expect process:

spawn -noecho telnet
expect {


View 3 Replies View Related

Programming :: Libxml2: Removing Output On Stdout/stderr - Element CA Does Not Carry Attribute Maxlength

Jul 26, 2010

I'm using libxml2 to handle/manipulate some XML files. In order to check the consistency of a XML file, I have a DTD and I'm using the xmlValidateDtd method to compute the check.

However, when an error occures during the check (for example an attribute is missing in a XML tag), then libxml2 writes the error on the stdout/stderr. For exemple:


/home/XML/FreeFour.xml:18: element CA: validity error : Element CA does not carry attribute maxlength

The method return the right result (true or false depending on the check result), but occurring errors are written on the stdout/stderr, and I actually don't want that.

View 4 Replies View Related

Programming :: Redirecting Stdout To File And Terminal And Stderr To File?

Apr 20, 2010

I have a script where I want to redirect stdout to the terminal and also to a log file aswell as redirecting stderr to the same log file but not the terminal.I have the following code which I found on the net which redirects both stderr and stdout to a file and the logfile,

Code: if [ -p $PIPE1 ]
rm $PIPE1


View 3 Replies View Related

Debian Programming :: Assign Variable In Bash When Stdout Is Updated

Jan 17, 2014

I am writing a script that calls a program which writes a lot of lines to stdout continuosly. If the last line in stdout has some regex, THEN, certain variables are updated. My problem is that I don't know how to do that.

A simplified example would be (it's not my exact case, but it I write it here to clarify): suppose I issue a ping command (which writes output to stdout continuously). Every time that the response time is t=0.025 ms, THEN, VARIABLE1=(column1 of that line) and VARIABLE2=(column2 of that line).

I think the following code would work in awk (however, I want the variables in bash and I don't know how to export them)

Code: Select allping localhost |awk '{ if ( $8 == "time=0.025" ) var1=$1 var2=$2}'

In the previous code, awk analyzes each line of the output of the ping command as soon as it is created, so the variables $var1, $var2, ... are updated at the appropriate time. But I need the "real-time" updated values of $var1, $var2 in bash, for later use in the script.

View 7 Replies View Related

Software :: Bash Output Stderr To 2 Files And Stdout?

Apr 5, 2011

I want to output the stdout and stderr in a logfile,moreover i do want to log stderr also to a separate logfile, and print str to the screen I searched arround and tried:


$ command 2>&1 > log | tee -a log log.err

But then in log first the stdout appears, and then stderr.

View 1 Replies View Related

General :: Script To Output Both The Stderr And Stdout To The Same Text File?

Aug 5, 2011

Am having issues getting the output from a script to be logged in a file. I need the script to output both the stderr and stdout to the same text file.

At present I have the following script:

echo TR3_1 > printers.txt
snmpget -v 1 -c public 10.168.**.* SNMPv2-SMI::mib- &>> printers.txt


View 4 Replies View Related

Programming :: Using Piped Data As Input - Cannot Stat '-': No Such File Or Directory

Nov 6, 2010

Code: stuart@stuart:~/$cat showthread.php.html | grep -o [URL][^"< ]*" | uniq | head -n3 | plowdown - cannot stat '-': No such file or directory Code: stuart@stuart:~/$ awk NR==$x Musiclist.txt | cut -d/ -f6 | basename $1 .mp3 .mp3 Here's some system info on the bash i'm using:


View 13 Replies View Related

Programming :: Not Getting Right Output To Correct Terminal Window

Jun 17, 2010

I have a server client prog in which server is my 'agent' and client is 'manager'. Following is the code for both agent and manager. I want my agent to send what manager is requesting. But it is not working the way I want. The parameters which manager is requesting, agent has to send to manager but in this program result for those parameters is shown on agent's own terminal window. Where as I want them on manager's window. Secondly, there result is not correct, means it is giving ' 0 K ram and 0 no of process....

//code for MANAGER
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h> .....

View 2 Replies View Related

Ubuntu :: Redirecting Iwconfig - Eth0 - Has No Wireless Extension Are Still Outputted To The Terminal (stdout)

Mar 11, 2011

When iwconfig is redirected thus Code: iwconfig >> wireless.txt things like Code: eth0 - Has no wireles extension are still outputted to the terminal (stdout)

View 2 Replies View Related

Programming :: Using Stdout For More Than One Task?

Jun 30, 2009

I want to parse my mail log file and reuse the results but I'm having a hard time structuring the syntax. Something like:


grep hostname /var/log/mail.log |
grep NOQUEUE: |
sed -e 's/hostname postfix/smtpd/[[0-9]*]: //g'

at this point I want to redirect what I have in hand to a file but also ... fork? or split? whatever the term, to continue onward so that I can pipe the results further into wc -l or sort or programX. without having to re-loop through that huge log file.

View 2 Replies View Related

Programming :: Blacklist End Up In File And $a End Up In Stdout?

Jan 22, 2010

In this example, why does blacklist end up in the file blacklist and $a end up in stdout?


The desired result is to have a file containing the results of lsmod which had the first word on the line beginning with snd_ copied into another file preceded by the word blacklist.

View 4 Replies View Related

Debian Multimedia :: Output DFP2 Not Found Warning On Terminal

Feb 23, 2016

Every time I open my terminal a warning message shows up. The warning is the following:

Code: Select allwarning: output DFP2 not found; ignoring

There is no output DFP2 in my system. I ran xrarndr and the outputs are the following:

Code: Select allScreen 0: minimum 320 x 200, current 3840 x 1080, maximum 8192 x 8192
VGA1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 477mm x 268mm
   1920x1080     60.00*+
   1680x1050     59.95 
   1600x900      59.98 
   1280x1024     75.02    60.02 

[Code] ......   

HDMI1 disconnected (normal left inverted right x axis y axis)
DP1 disconnected (normal left inverted right x axis y axis)
HDMI2 connected primary 1920x1080+1920+0 (normal left inverted right x axis y axis) 477mm x 268mm

   1920x1080     60.00*+  50.00    59.94 
   1680x1050     59.88 
   1600x900      59.98 
   1280x1024     75.02    60.02 

[Code] ....

HDMI3 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
DP3 disconnected (normal left inverted right x axis y axis)

View 2 Replies View Related

Programming :: Cannot Redirect All Stdout And Stderr Into File

May 12, 2009

I have a little complex Makefile system. A parent Makefile call dozens of Makefiles in subdirctories. And the subdirctory Makefile calles shell script to do real building. I want to grab all output this Makefile system generate. So, i employ "make 2>&1 > make.log". but not all output messages are filed into make.log. The message generated by sub-makefile called shell script cannot be recorded into make.log. And another curiouse thing is, if i launch "make 2>&1 > make.log" in a perl script, all output do be sent into make.log.

View 2 Replies View Related

Programming :: Capture The Stdout Of A Heredoc In A Variable?

Aug 12, 2010

Why doesn't this work?

cat | myvar=$(</dev/stdin) <<EOS
This is some content
echo "$myvar"

i have also tried several variants of cat in place of the redirection.

$(cat -)
$(cat /dev/stdin)

None of the variants print "This is some content"

I have a version that works:

myvar=$(cat <<EOS
This is some content
echo "$myvar"

but i don't like the syntax and it doesn't play nice in my editor with code folding.

View 5 Replies View Related

Programming :: Redirecting Stdin / Stdout And Stderr For Program Run As Fork()/execl()?

Nov 24, 2010

I'm trying to write a program that will fork a series of FTP sessions. For each session, there should be separate input and output files associated with stdin and stdout/stderr.
I keep reading how I should be able to do that with dup2() in the child process before the execl(), but it's not working for me. Could someone please explain what I've done wrong? The program also has a 30-second sniper alarm for testing and killing of FTPs that go dormant for too long.

The code: (ftpmon.c)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


The output:

$ ftpmon
Connected to (
220 (vsFTPd 2.0.1)
ftp> waitpid(): Interrupted system call

Why am I getting the ftp> prompt? If the dup2() works, shouldn't it be taking input from my script and not my terminal? In stead, it does nothing, and winds up getting killed after 30 seconds. The log file is created, but it's empty after the run.

View 3 Replies View Related

Programming :: Redirecting Stdin / Stdout And Stderr And Finding Files Name And Other Stats?

Aug 8, 2010

I'm working on an application used for backup/archiving. That can be archiving contents on block devices, tapes, as well as regular files. The application stores data in hard packed low redundancy heaps with multiple indexes pointing out uniquely stored, (shared), fractions in the heap.

And the application supports taking and reverting to snapshot of total storage on several computers running different OS, as well as simply taking on archiving of single files. It uses hamming code diversity to defeat the disk rot, instead of using raid arrays which has proven to become pretty much useless when the arrays climb over some terabytes in size. It is intended to be a distributed CMS (content management system) for a diversity of platforms, with focus on secure storage/archiving. i have a unix shell tool that acts like gzip, cat, dd etc in being able to pipe data between applications.


dd if=/dev/sda bs=1b | gzip -cq > my.sda.raw.gz

the tool can handle different files in a struct array, like:


enum FilesOpenStatusValue {
FileIsClosed = 0,


Is there a better way of getting the file name of the redirected file, (respecting the fact that there may not always exist such a thing as a file name for a redirection pipe).
Should i work with inodes instead, and then take a completely different approach when porting to non-unix platforms? Why isn't there a system call like get_filename(stdin); ?

If you have any input on this, or some questions, then please don't hesitate to post in this thread. To add some offtopic to the thread - Here is a performance tip: When doing data shuffling on streams one should avoid just using some arbitrary record length, (like 512 bytes). Use stat() to get the recommended block size in stat.st_blksize and use copy buffers of that size to get optimal throughput in your programs.

View 4 Replies View Related

Programming :: STDIN, STDOUT, STDERROR Redirection For Scripting - Bash: Log.txt: No Such File Or Directory

Sep 7, 2010

I'm writing a script to execute bash commands in the PHP CLI. I would like to suppress errors from bash and write my own error message if an error occurs. So far I have this (assuming log.txt doesn't exist!):


tac log.txt 2>/dev/null

Which works as expected, tac kicks up an error but the error is suppressed, but when I use this:


tac < log.txt 2>/dev/null

I get:


bash: log.txt: No such file or directory

The tac error is suppressed but bash still gives me a dirty error.

View 2 Replies View Related

General :: How To Redirect A Terminal/tty Output To Other Terminal/tty

Dec 14, 2010

I tried to find a good subject but it was the best of mine, anyway I'll explain it here.
some time I do some thing like installing a new application in Linux terminal of my office PC but it take a long time and I have to go home during its installation or configuration process that it is not good to cancel it.My current solution is abandoning the process until next day. I wanted to know is there any way to redirect an input and out put of a terminal to another one, if it works I can continue my abandoned process by ssh to my Linux office PC and redirect that terminal to my new remote sshed terminal from my home.

Thank a lot for any help.

View 4 Replies View Related

Debian Programming :: Command Followed By And Still Closes With Terminal?

Jan 4, 2014

Running debian wheezy. I noticed recently, whenever I fork a process using "&" from a terminal, such as

Code: Select allleafpad &

it starts up, shows the processid in the terminal, but every time when I close the terminal, leafpad gets killed. However, I create a simple bash script,

Code: Select all#!/bin/bash

The script launches leafpad, then exits out leaving leafpad running, as it should. Is what I mentioned above normal? I'm confused, because I think I used to be able to do this in terminal without it depending on the terminal to stay running.

I guess I'm remembering wrong. As it turns out, commands begun on terminal get closed with terminal unless, as mentioned, you use nohup or start subshell. Process hierarchy and tracking etc.

View 6 Replies View Related

Ubuntu :: Starts Conky But Also Shows "output To That Terminal So You Can't Do Any Other Commands To That Terminal"

Jan 24, 2010

if you do the command conky in terminal, it starts conky ofcourse, but it also shows output to that terminal so you can't do any other commands to that terminal, Is their an option like you can do with the '&' sign in other cases? If you do the '&' sign with conky it still gives output, also the conky -d command gives output...

View 9 Replies View Related

Debian Programming :: Trigger Interrupt With Middle Mouse Button In Terminal

Feb 2, 2015

Ctrl-c with middle mouse button (MMB) trigger in running bash script trigger.

The key combination Ctrl-C or "^C" with the keyboard triggered on a running bash script stands for "signal interrupt" (SIGINT) and terminates the process.

For my workflow in the test phase, how I could do that with the MMB-Buffer, followed by the modified script command:

Code: Select allscript runs
script runs
script runs

Signal interrupt and rerun with MMB trigger:

Code: Select all^C; ./
modified script runs
modified script runs
does not work and 2 hours meta-crawlers

View 1 Replies View Related

Fedora :: Saving Videos That Are Piped?

Jun 1, 2011

Is there a simple way to save a video that appears in the /tmp directory as a pipe instead of a video file format? I was watching some of the old educational films on fluid dynamics from t the only evidence I see of a fileaSL_PIPE_500_SingleOfficeIPC_ff7ed09f7cfaad13bfa22 2a40c3fd37

View 2 Replies View Related

Server :: Passing Piped Emails On To Qmail Again?

Aug 3, 2010

I am doing this project for our school. Basically we want to pipe all incoming emails to a script which filters out certain messages (not only spam but duplicates, large messages, etc). If they fail certain criteria, the script simply does nothing.If they pass , then the script should pass the entire message (headers and body) back on to qmail to send. The piping part is not a problem, but I am stuck with the next part. Is there a way to pass the headers and body back to qmail for it to process and send, as if it received it the first time?Some details:A catchall email account is created via Plesk control panel on linux (centos).THe .qmail file in /var/qmail/mailnames/ is edited to include the line:-|/path/to/pipe/handler.phpThe handler.php file simply reads the entire message (headers and body) and they are then parsed and analysed.

View 2 Replies View Related

Slackware :: 'less' Command - Prints Garbage When Piped

Mar 5, 2010

When i pipe commands through 'less' in console, i get a load of garbage mixed into the results, and no colors either. Mainly the letters 'Esc' printed a couple of times on each line.

I had been messing about with my bash config files but i can't see anything in there to affect this. If I pipe through 'more' there is no problem, only 'less'.

View 11 Replies View Related

Fedora :: Sound Stutters On Second Play?

Jun 26, 2010

First things first: I'm running F12 KDE and yum informs me that I'm fully up to dateI'm having a problem where the second sound that my computer plays stutters - this is best seen in amarok, the first track will play fine but the second track will stutter and play really slowly. I asked on IRC and the suggestion came back that it was possibly due to this bug[URL]

View 3 Replies View Related

Ubuntu :: Maverick Stutters After Some VLC DVD Playback?

Oct 15, 2010

although VLC playback triggers it, I suspect it's actually a kernel problem. After moving from 10.04 x64 to 10.10 x64, I've been noticing the following problem: When watching a DVD .iso using VLC Media Player, the system will become "jerky" and "stutter" after a random amount of smooth playback. At that point, the only way to make the system smooth and responsive again is a hard restart (normal shutdown hangs and refuses to complete).where I can start looking to find where the bug lies? My laptop is an Acer Aspire 6930 with 10.10 x64 and the current NVidia display driver.

View 7 Replies View Related

Programming :: Invoke Java From Bash Terminal Via Shell Script Fails Under Mint Debian / Fix It?

Feb 16, 2011

I am running a Java application on the command line bash terminal under Mint Debian. I have JDK1.6.0_22 installed 64-bit, and the OS is 64-bit too. I have a few JAR files in the directory and a few native LWJGL libraries. When I run the application using the command line, all works fine.
Lets assume my directory where the files are is called /home/riz/MyGame. I change to that directory and this is the command I use code...

View 3 Replies View Related

Ubuntu :: Possible To Use Piped Command As Opposed To An All Out Complex Method

Dec 1, 2010

I would like to keep this simple and if possible use a piped command as opposed to an all out complex method.I have a script that does many things for me, and one of them builds a basic simple system report (I know about lshw, but this is for me to learn as well as be functional)

I would like to add another pipe to remove the"model name:" portion.I do not really want to use the store in a variable first solutions if I can help it.

View 7 Replies View Related

Copyrights 2005-15, All rights reserved