LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 03-26-2009, 03:43 PM   #1
Geneset
Member
 
Registered: Jan 2007
Location: Athlone, ROI
Distribution: Ubuntu Hardy Desktop, Solaris 10, Workstation 2008 x64
Posts: 75

Rep: Reputation: 16
Question pipe gnuplot + while read does not behave as expected


Hi folks, hope your all well.

I'm piping the output from gnuplot and want to log each line of output separatly. This is what i have so far

Code:
gnuplot $CMD 2>&1 | while read line; do 
    log $line
done
Looks simple right? I'm assuming that read parses newlines

Problem is the log is like this
Code:
${log prefix stuff}: FIRST LINE OF ERROR
NEXT LINE OF ERROR
NEXT LINE OF ERROR
...
etc etc and so forth.

Anyone have any genius idea I completely missed?

Regards
G

:Edit
Should have said that the logging function works fine in about 200 other places im using it. Throw it a string and it records it and prints it the way its supposed to.

Last edited by Geneset; 03-26-2009 at 03:44 PM. Reason: Update
 
Old 03-29-2009, 04:23 PM   #2
MrUmunhum
Member
 
Registered: May 2006
Location: Mt Umunhum, CA, USA
Distribution: Debian/ Fedora
Posts: 435

Rep: Reputation: 33
Quote:
Originally Posted by Geneset View Post
Problem is the log is like this
Code:
${log prefix stuff}: FIRST LINE OF ERROR
NEXT LINE OF ERROR
NEXT LINE OF ERROR
...
What did you expect to see? Something like this?
Code:
${log prefix stuff}: 
FIRST LINE OF ERROR
NEXT LINE OF ERROR
NEXT LINE OF ERROR
...
What OS are you running?
 
  


Reply

Tags
gnuplot, loop, pipe, read, while


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting a scanner to behave .... expatCM Linux - Software 1 01-04-2009 08:33 AM
popen() doesn't behave as expected Kimbo Programming 4 07-28-2007 07:26 AM
time taken to read the information present in pipe ujnam Programming 0 10-27-2004 05:19 AM
Read the output from a pipe with bash ? fluppi Linux - Software 3 01-13-2004 01:59 PM
read and pipe function dummyagain Programming 13 09-24-2003 11:36 PM


All times are GMT -5. The time now is 07:29 AM.

Main Menu
Advertisement
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