jobs -l | sed ... = nothing!?

I can't seem to filter the output of jobs -l (/bin/sh).
Never had a problem with this on NetBSD.
Really strange.
It must be something really obvious I'm over looking.
What could it be?

jobs -l |sed 's/\(.\{40\}\)\(.*\)/\1/'

I can redirect it to a file though.

jobs -l > .j &&
sed 's/\(.\{40\}\)\(.*\)/\1/' .j

try this..

 
jobs -l | awk '{print substr($0,1,40)}'

I like it.
But still I get nothing.
I can't figure out where the output is going.

Since it's a shell builtin, it may be writing direct to the terminal and able to ignore all redirection. The time builtin can play strange games like that too.

I suspect that this is an unusual Shell and it is running a pipeline in a subshell such that the "jobs" command has lost its context.
Either that or there is more to this script and the command is in a subshell.

It's the standard FreeBSD /bin/sh, i.e. ash.

No doubt the answer lies in the source code. Still being a C noob, I gave up. But I may return to this since it has my curiousity.

I believe the Bourne shell sometimes opens double digit file descriptors instead of just 0, 1, or 2. fd 14? I've forgotten the details and I'd have to look it up again. I believe this is discussed on Sven Mascheck's site.

Is it possible the jobs builtin is using another fd? fd 10?

Being file descriptors are not actually decimal numbers, there's no particular significance to "double-digit" file descriptors. Checking ash on my own system, it does in fact open FD 10 to go directly to /dev/tty... But then, my version of ash works fine with jobs | awk ... so isn't the same as yours anyway.

As already mentioned, jobs is a builtin, not an external command, so it may not obey redirections at all, just like the time builtin doesn't. Being not a real process at all means the redirections don't necessarily even get processed.

Did you try to see if you get the result from fd 2 ?

2>&1 jobs -l |sed 's/\(.\{40\}\)\(.*\)/\1/'

?