Control: tags -1 - moreinfo unreproducible + pending
Hi, 2016-02-24 02:34 Norbert Kiesel:
Hi Manuel, my goal was pretty simply: I wanted the output be nicely aligned even when it's piped. When I tried that using -F I thought that -F is just ignored. However, as you have shown that is not the case. Nevertheless, it seems that setting the width of columns does not work as I expected:
That's because it acts as --disable-columns, so widths are ignored in that case.
Perhaps I'm still not understanding how to correctly use this? Is there a way to have `aptitude search '~N' | head -3` produce aligned output? Right now the only solution I see is something ugly like the following # aptitude -F '%p %d' search '~N' | perl -ne 'printf("%-30s - %s\n", /(\S+) (.+)/)' | head -3 icingacli - simple CLI tool for Icingaweb2 and its modules icingaweb2-common - simple and responsive web interface for Icinga - common files libp8-platform-dev - Pulse-Eight's platform support library -- development files
Right. So if you want to parse the different fields, the "machine-parsable" that you mentioned, I think that it's better to use "-F '%p ΒΆ %d'", with some strange separator character that does not appear in the descriptions (although I wonder if there's a way to really guarantee that... perhaps control characters). For getting aligned output when piping/redirecting and you want to set a width anyway, I made it to "columnize" and using -w/::Width when set explicitly instead of "--disabling-columns". It still acts as "--disabling-columns" if width not set explicitly (because it cannot be guessed correctly in that case). So "`aptitude search -w $COLUMNS > t; less t` worked in 0.7.4", should work again in > 0.7.6. Marking as +pending. 2016-02-24 02:53 Norbert Kiesel:
Actually I started to like the perl post-processing, so I will simply close my bug report although I'm still not understanding why the width in the format does not work in piped context.
It's probably more useful for a range of use-cases, yes. Anyway, changed now in the case that you or anybody else still want to use the functionality. Cheers. -- Manuel A. Fernandez Montecelo <manuel.montez...@gmail.com>