[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: ZSH completion for kdesrc-build
From:       Thiago Macieira <thiago () kde ! org>
Date:       2014-01-11 16:04:13
Message-ID: 1730380.eEWOWl8tMO () tjmaciei-mobl2
[Download RAW message or body]


On sábado, 11 de janeiro de 2014 11:38:25, Ivan Čukić wrote:
> function _ksrccomp() {
>   reply=(`grep identifier kde_projects.xml | sed 's/^[^"]*"//' | sed
> 's/".*//' | sort -u`)
> }

Replace the grep and two sed with just one sed:

   reply=(`sed -n 's/.*identifier="\(.*\)".*/\1/p' kde_projects.xml | sort -u`)

You can also use zsh expansion modifiers "o" and "u" to sort and uniquify:

    reply=(`sed -n 's/.*identifier="\(.*\)".*/\1/p' kde_projects.xml`)
    reply=(${(ou)reply})

If you want to go further, you can replace the sed with a while read :-)

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic