LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 07-01-2010, 08:13 AM   #1
brubizu
LQ Newbie
 
Registered: Jun 2010
Posts: 11

Rep: Reputation: 0
Weird thing in redirecting stdout and stderr


Hi... I'm trying to redirect the progress percentage of the mkisofs command to a zenity window... the thing is, mkisofs prints the xx% to the stderr... so what I'm trying to do is:

Code:
mkisofs options ../filename.iso . 2>&1 | grep done
and that "works"... I mean, it does print the correct lines on the terminal... however if a try to write to a file, or pipe it to another command, awk for example:

Code:
mkisofs options ../filename.iso . 2>&1 | grep done | awk '{print $1}'
it doesn't print anything...

Code:
mkisofs options ../filename.iso . 2>&1 | grep done > foo
this will make foo an empty file...

what am I doing wrong?
 
Old 07-01-2010, 09:18 AM   #2
brubizu
LQ Newbie
 
Registered: Jun 2010
Posts: 11

Original Poster
Rep: Reputation: 0
it is working, but the numbers are printed almos all at once at the end of iso building.
 
Old 07-01-2010, 11:09 AM   #3
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
Might be line buffering by grep. Try to use grep --line-buffered

I had a similar issue and matir suggested the above.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
example for redirecting stderr,stdout in seperate files using two way pipes concept nagendrar Programming 0 07-06-2009 06:08 AM
redirecting BASH script stdout/stderr from the script itself Hewson Linux - General 4 04-18-2008 03:32 PM
Redirecting stdout, stderr to pty0? Rostfrei Linux - General 4 03-20-2007 03:15 AM
redirecting stdout to /dev/null and stderr to stdout? Thinking Programming 1 05-18-2006 02:36 AM
redirecting stdout and stderr to a file Avatar33 Programming 4 03-12-2005 07:55 AM


All times are GMT -5. The time now is 09:13 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration