Sunday, September 12, 2010

Remove useless repositories by awk in OpenSUSE

帽客的桌機一路從OpenSUSE 11.1升級到OpenSUSE 11.3後,repositories都沒去清掉,導致一堆沒有在用的repos殘留在那邊,練習一下用awk把沒用的repos一次清光:
linux-8zbb:~ # zypper rr `zypper lr | awk '/No/{ print $3 }'`
Repository 'openSUSE' not found by alias, number or URI.
Removing repository 'Packman repository (openSUSE_11.1)' [done]
Repository 'Packman repository (openSUSE_11.1)' has been removed.
Removing repository 'openSUSE 11.2-0' [done]
Repository 'openSUSE 11.2-0' has been removed.
Removing repository 'opensuse11.2_oss' [done]
Repository 'opensuse11.2_oss' has been removed.
Removing repository 'opensuse11.2_update' [done]
Repository 'opensuse11.2_update' has been removed.
Removing repository 'opensuse_11.2_non-oss' [done]
Repository 'opensuse_11.2_non-oss' has been removed.
Removing repository 'opensuse 11.3 iso' [done]
Repository 'opensuse 11.3 iso' has been removed.
Removing repository 'packman' [done]
Repository 'packman' has been removed.
Removing repository 'openSUSE-11.1-Debug' [done]
Repository 'openSUSE-11.1-Debug' has been removed.
Removing repository 'openSUSE-11.1-Non-Oss' [done]
Repository 'openSUSE-11.1-Non-Oss' has been removed.
Removing repository 'openSUSE-11.1-Oss' [done]
Repository 'openSUSE-11.1-Oss' has been removed.
Removing repository 'openSUSE-11.1-Source' [done]
Repository 'openSUSE-11.1-Source' has been removed.
Removing repository 'openSUSE-11.1-Update' [done]
Repository 'openSUSE-11.1-Update' has been removed.
只能說awk好用又有效率~

1 comment:

Max said...

^^

也可以請您 一起在 planet.opensuse.org/tw

http://planet.opensuse.org/tw/

交流嗎