Daily one shell (ix) Yum install package sort go heavy

Source: Internet
Author: User
Tags cairo gettext gmp readline tar unzip
Now there are a bunch of yum installation packages that need to be installed, so I want to use batch installation. The merged installation packages have duplicates, so I decided to remove them first.
The source installation package is as follows:
python-devel python-imaging zip unzip openssl openssl-devel gcc libxml2 libxml2-dev libxslt * zlib zlib-devel libjpeg-devel libpng-devel libwebp libwebp-devel freetype freetype-devel lsof pcre pcre-devel vixie-cron crontabs icu libicu-devel c-ares make cmake gcc gcc-c ++ gcc-g77 flex bison file libtool libtool-libs autoconf kernel-devel patch wget libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel tar bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel libcurl libcurl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel vim-minimal gettext-devel gmp-devel pspell-devel libcap diffutils ca-certificates net-tools libc-client-devel psmisc libXpm-devel git-core c-ares-devel libicu-devel libxslt libxslt-devel zip unzip glibc.i686 libstdc ++. so.6 cairo- devel bison-devel ncurses-devel libaio-devel perl perl-devel perl-Data-Dumper lsof pcre pcre-devel vixie-cron crontabs expat-devel readline-devel wget python-devel python-imaging zip unzip openssl openssl-devel gcc libxml2 libxml2-dev libxslt * zlib zlib-devel libjpeg-devel libpng-devel libwebp libwebp-devel freetype freetype-devel lsof pcre pcre-devel vixie-cron crontabs crontabs icu libicu-devel c-ares
Idea: Use awk to replace separators, convert spaces to newlines, sort, deduplicate, convert lines to spaces, merge into one line, remove spaces at the beginning of the line

cat yumqucong.sh

#!/bin/bash
#writen by Aiker

echo "python-devel python-imaging zip unzip openssl openssl-devel gcc libxml2 libxml2-dev libxslt* zlib zlib-devel libjpeg-devel libpng-devel libwebp libwebp-devel freetype freetype-devel lsof pcre pcre-devel vixie-cron crontabs icu libicu-devel c-ares make cmake gcc gcc-c++ gcc-g77 flex bison file libtool libtool-libs autoconf kernel-devel patch wget libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel tar bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel libcurl libcurl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel vim-minimal gettext gettext-devel ncurses-devel gmp-devel pspell-devel libcap diffutils ca-certificates net-tools libc-client-devel psmisc libXpm-devel git-core c-ares-devel libicu-devel libxslt libxslt-devel zip unzip glibc.i686 libstdc++.so.6 cairo-devel bison-devel ncurses-devel libaio-devel perl perl-devel perl-Data-Dumper lsof pcre pcre-devel vixie-cron crontabs expat-devel readline-devel wget python-devel python-imaging zip unzip openssl openssl-devel gcc libxml2 libxml2-dev libxslt* zlib zlib-devel libjpeg-devel libpng-devel libwebp libwebp-devel freetype freetype-devel lsof pcre pcre-devel vixie-cron crontabs crontabs icu libicu-devel c-ares" | awk ‘{for(x=1;x<=NF;x++) {print $x}} {print "\n"}‘ | sort | uniq | tr "\r\n" " " | sed -e ‘s/\r\n/ /g‘ -e ‘s/^ //g‘

output:

autoconf bison bison-devel bzip2 bzip2-devel ca-certificates cairo-devel c-ares c-ares-devel cmake crontabs curl curl-devel diffutils e2fsprogs e2fsprogs-devel expat-devel file flex freetype freetype-devel gcc gcc-c++ gcc-g77 gd gd-devel gettext gettext-devel git-core glib2 glib2-devel glibc.i686 gmp-devel icu kernel-devel krb5 krb5-devel libaio-devel libcap libc-client-devel libcurl libcurl-devel libevent libevent-devel libicu-devel libidn libidn-devel libjpeg libjpeg-devel libpng libpng10 libpng10-devel libpng-devel libstdc++.so.6 libtool libtool-libs libwebp libwebp-devel libxml2 libxml2-dev libxml2-devel libXpm-devel libxslt libxslt* libxslt-devel lsof make ncurses ncurses-devel net-tools openssl openssl-devel patch pcre pcre-devel perl perl-Data-Dumper perl-devel psmisc pspell-devel python-devel python-imaging readline-devel tar unzip vim-minimal vixie-cron wget zip zlib zlib-devel

You can also save the original yum package as a file, and then process the file:

cat yumlist.txt

python-devel python-imaging zip unzip openssl openssl-devel gcc libxml2 libxml2-dev libxslt * zlib zlib-devel libjpeg-devel libpng-devel libwebp libwebp-devel freetype freetype-devel lsof pcre pcre-devel vixie-cron crontabs icu libicu-devel c-ares make cmake gcc gcc-c ++ gcc-g77 flex bison file libtool libtool-libs autoconf kernel-devel patch wget libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel tar bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel libcurl libcurl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel vim-minimal gettext-devel gmp-devel pspell-devel libcap diffutils ca-certificates net-tools libc-client-devel psmisc libXpm-devel git-core c-ares-devel libicu-devel libxslt libxslt-devel zip unzip glibc.i686 libstdc ++. so.6 cairo- devel bison-devel ncurses-devel libaio-devel perl perl-devel perl-Data-Dumper lsof pcre pcre-devel vixie-cron crontabs expat-devel readline-devel wget python-devel python-imaging zip unzip openssl openssl-devel gcc libxml2 libxml2-dev libxslt * zlib zlib-devel libjpeg-devel libpng-devel libwebp libwebp-devel freetype freetype-devel lsof pcre pcre-devel vixie-cron crontabs crontabs icu libicu-devel c-ares
cat yumqucong.sh

#! / bin / bash
#writen by Aiker

awk '{for (x = 1; x <= NF; x ++) {print $ x}} {print "\ n"}' yumlist.txt | sort | uniq | tr "\ r \ n" "" | sed- e 's / \ r \ n / / g' -e 's / ^ // g'
Daily one shell (nine) yum installation package sort deduplication


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.