Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to get a stdout when CL doesn't provide one.

I like being able to output MAN files into PDF's, but there's one in particular (afconvert) that has a bare bones MAN file, which says you should use the switch afconvrt -h to get the info your looking for. I guess whomever at Apple that wrote afconvert used to work for Microsoft! LOL!


Anyway, how do I pipe out afconvert -h to a text or PDF file? I can't seem to get that to work. I'm assuming since it doesn't contain a real stdout?

MacBook Air (13-inch Mid 2012), OS X Mavericks (10.9.2)

Posted on Apr 16, 2014 7:41 AM

Reply
15 replies

Apr 16, 2014 7:08 PM in response to Tony T1

So awesome!


And for the win, can we combine afconvert -h and afconvert -hf into one combined PDF?


I tried exporting both as text files, the using cat to combine, and cupsfilter to convert to PDF. The results were and ugly font. If I convert the combined text file to RTF using textutul, and then use cupsfiler, it gets better, but still not as nice as the direct output to PDF using pstopdf.


Is it doable?

Apr 17, 2014 5:51 AM in response to napabar

Is it doable?


Try this:


cat <(afconvert -h 2>&1) <(echo) <(afconvert -hf 2>&1) | groff -Tps | pstopdf -i -o afconvert.pdf


[Note: while it worked, I get a groff error: "<standard input>:161: cannot use character `0' as a starting delimiter", however, the PDF file is created as intended. The error can be suppressed with -E: groff -Tps -E]

Apr 17, 2014 6:25 AM in response to Tony T1

Found the source of the error.

In afconvert -hf, these 2 lines (line 32 and 33) are causing the groff error:

LEI32 LEF32 LEF64 'ms\x00\x02' 'ms\x00\x11'

'ms\x001' 'paac' 'samr' 'ulaw' 'zaac' 'zach'

This is due to the escape charater \x

So, there is an error in the PDF as these 2 lines will be changed to:

LEI32 LEF32 LEF64 ’ms02’ ’ms01

ms01’ ’paac’ ’samr’ ’ulaw’ ’zaac’ ’zach’


So, with sed, this can be corrected by escaping the escapes:


cat <(afconvert -h 2>&1) <(echo) <(afconvert -hf 2>&1) | sed 's/\\/\\\\/g' | groff -Tps | pstopdf -i -o afconvert.pdf

How to get a stdout when CL doesn't provide one.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.