
Hi, Following on from the recent bash script reviews, if anyone would like to comment on this one, please do: https://code.vpac.org/gitorious/patchman/patchman/blobs/master/client/patchm... The above script attempts to obtain a list of installed packages and enabled repos on debian/centos hosts, and sends that list to a central server. However, I'm having some sed/grep/awk issues. I'm trying to parse the output of "yum repolist enabled --verbose" and return each repo on a line as so 'rpm' 'this-repo-name' 'http://url1' 'http://url2' The output is similar to the following: Repo-id : extras Repo-name : CentOS-5 - Extras Repo-updated : Tue Oct 25 03:18:58 2011 Repo-pkgs : 237 Repo-size : 124 M Repo-baseurl : http://ftp.swin.edu.au/centos/5/extras/x86_64/, : http://ftp.monash.edu.au/pub/linux/CentOS/5/extras/x86_64/, : http://mirror.aarnet.edu.au/pub/centos/5/extras/x86_64/ Repo-expire : 3,600 second(s) (last: Wed Nov 16 12:39:48 2011) So I just need the Repo-name and the Repo-baseurls for each repo. If there is one baseurl, my version works, but if there are multiple, it breaks: # yum repolist enabled --verbose | egrep "Repo-name|Repo-baseurl" | sed -e ':a;N;$!ba;s/\nRepo-baseurl//g' -e "s/Repo-name[ ]*: /'/g" -e "s/[ ]*:[ ]\+/' '/g" | sed -e "s/$/'/g" -e "s/'/ ${host_arch}'/2" -e "s/\/'/'/g" -e "s/ ' '/' '/" 'CentOS-5 - Base' 'http://ftp.swin.edu.au/centos/5/os/x86_64/,' 'CentOS-5 - Extras' 'http://ftp.swin.edu.au/centos/5/extras/x86_64/,' 'CentOS-5 - Updates' 'http://ftp.swin.edu.au/centos/5/updates/x86_64/,' The extra comma at the end of the url is not meant to be there, and the additional baseurls are missing. Are there any awk or sed gurus that can help me get the final part of this? Thanks, Marcus. -- Marcus Furlong