In the shell, when I pipe jack_cpu_load through sed, or cut, no matter what options I use it stops printing just before the lines I want to see.

jack_cpu_load | sed -n 8p will print:

Jack: JackClient::kActivateClient name = jack_cpu_load ref = 4

The very next line should read something like jack DSP load 0.294772 which is what I'm looking for, but when I run jack_cpu_load | sed -n 9p which should print that line, there is nothing. Just a cursor, until I hit Ctrl+C and kill it.

Unfortunately there is very little documentation on this command and I'm just a user, a musician no less, trying to hack together something that will let me see the dsp load at a glance in my status bar.

Terminal Output:

tony@hydra ~ $ jack_cpu_load
Jack: JackClient::SetupDriverSync driver sem in flush mode
Jack: JackPosixSemaphore::Connect name = jack_sem.1000_default_jack_cpu_load
Jack: JackPosixSemaphore::Connect sem_getvalue 0
Jack: Clock source : system clock via clock_gettime
Jack: JackLibClient::Open name = jack_cpu_load refnum = 4
Jack: JackClient::Activate
Jack: JackClient::ClientNotify ref = 4 name = jack_cpu_load notify = 2
Jack: JackClient::kActivateClient name = jack_cpu_load ref = 4 
jack DSP load 0.163633
jack DSP load 0.159914
jack DSP load 0.159449
jack DSP load 0.164087
jack DSP load 0.159971
^CJack: jack_client_close  

For this:

tony@hydra ~ $ jack_cpu_load 2>&1 | sed -n 8p
Jack: JackClient::kActivateClient name = jack_cpu_load ref = 4 

And for this:

tony@hydra ~ $ jack_cpu_load 2>&1 | sed -n 9p  

There's nothing.

The output for strace -f jack_cpu_load http://justpaste.it/e7st

  • Maybe the output doesn't all go to stdout. Try jack_cpu_load 2>&1 | sed -n 8p. Does that help? If not can you fully copy what happens in your terminal please – Marki Jan 26 '14 at 12:09
  • I keep thinking that's what's going on but no, 2>&1 doesn't change anything. I added terminal output to the OP. – user57649 Jan 26 '14 at 16:33
  • Maybe it starts something in the background which outputs the other stuff... Here probably only using strace will shed light on what's going on. (strace -f jack.....) – Marki Jan 26 '14 at 18:27
  • I added a link to a file with the output. I see three pids, but beyond that I'm out of my depth. Thanks for the help. – user57649 Jan 26 '14 at 18:58
  • Currently I don't understand either. You see they all write to fd1 (stdout). You see it more clearly when you run strace -f -t -e trace=write jack_cpu_load. So no idea why you can't catch anything beyond the 8th line. What happens when you redirect to a file? (jack_cpu_load > bla.txt, wait for a while, then Ctrl-C, then inspect the file) – Marki Jan 26 '14 at 19:30

Maybe the output doesn't all go to stdout. Try jack_cpu_load 2>&1 | sed -n 8p

Or it is a buffering issue. Try stdbuf -i0 -o0 -e0 jack_cpu_load | sed -n 9p

  • Yes, buffering. – user57649 Jan 26 '14 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.