You are evil :) Thank you dude!


On 11 January 2014 21:34, Ivan Čukić <ivan.cukic@gmail.com> wrote:
You are evil :) Thank you dude!


On 11 January 2014 17:04, Thiago Macieira <thiago@kde.org> wrote:
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



--
While you were hanging yourself on someone else's words
Dying to believe in what you heard
I was staring straight into the shining sun



--
Cheerio,
Ivan

--
While you were hanging yourself on someone else's words
Dying to believe in what you heard
I was staring straight into the shining sun