On 5/11/07, Andrew Sackville-West <[EMAIL PROTECTED]> wrote:
On Fri, May 11, 2007 at 03:00:41PM -0700, L.V.Gandhi wrote: > Will you please explain the construct of /^[^D|+]/ in your > dpkg -l udev hotplug linux-image-\* | awk '/^[^D|+]/{print $1,$2,$3}' I've wondered about that too. In fact, I've been saving that mail all this time thinking I'd get around to deciphering it. Here's my swipe at it / = beginning and end of "match" for awk (the statement that its trying to match) ^ = match lines that *start* with whatever follows [...] = match any of the characters inside the brackets ^ = negate the above, so _don't_ match the characters D|+ = the list of characters to *not* match so this /^[^D|+]/ will exclude any line that starts with 'D' (like the first line of dpkg -l output, any line starting with '|' like the column headings, any line starting with '+' like the big line that underlines the headings. Its turns dpkg -l output from : Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad) ||/ Name Version Description +++-==============-==============-============================================ un linux-image <none> (no description available) un linux-image-2. <none> (no description available) ii linux-image-2. 2.6.18+6 Linux kernel 2.6 image on AMD K7 ii linux-image-2. 2.6.17-5 Linux kernel 2.6.17 image on AMD K7 machines ri linux-image-2. 2.6.17-9 Linux 2.6.17 image on AMD K7 ii linux-image-2. 2.6.18-3 Linux 2.6.18 image on AMD K7 ii linux-image-2. 2.6.18-8 Linux 2.6.18 image on AMD K7 ii linux-image-2. 2.6.18.dfsg.1- Linux 2.6.18 image on AMD K7 to un linux-image <none> un linux-image-2.6 <none> ii linux-image-2.6-k7 2.6.18+6 ii linux-image-2.6.17-1-k7 2.6.17-5 ri linux-image-2.6.17-2-k7 2.6.17-9 ii linux-image-2.6.18-1-k7 2.6.18-3 ii linux-image-2.6.18-3-k7 2.6.18-8 ii linux-image-2.6.18-4-k7 2.6.18.dfsg.1-12 right? Thanks for the nice explanation.
-- L.V.Gandhi http://lvgandhi.tripod.com/ linux user No.205042