Tiago Dias wrote: > Hi, > > I need a script which makes the package compação rpm's through two > text files ... > > Since a file is the output of the command *rpm-qa > pkg.out * > > And the second file is a list of several packages rpm's, multiple > versions and architectures. > > My idea is to compare a package *x* file pkg.out with several > packages *y* of the file update.out and know whether a package and has a > larger version of the package *x* installed and with that I return I have a > package to be updated. > > Does anyone can help me do this comparison? > > OBS.: The servers do not have access to internet. > > Here's an example of the packages described in the files: > I don't have the time to write it all out and debug it - I need to get out the door for work in a few min, but awk { read first file into associative array if ( FILENAME == "first" ) { file1["$1"] = 0; } else { if ( $1 in file1 ) { file1[ $1 ]++; } } } END { for $a in file1 { if ( file1[$a] > 0 ) { print $a; } } } > [root@rpm tiago]# tail -n12 pkg.out > glibc-devel-2.3.4-2.39 > libuser-devel-0.52.5-1.el4.1 > libmudflap-4.1.2-14.EL4 > iiimf-libs-devel-12.1-13.EL.6 > xorg-x11-devel-6.8.2-1.EL.33 > lam-libs-7.1.2-8 > libdbi-0.6.5-10.RHEL4.1 > unixODBC-kde-2.2.11-1.RHEL4.1 > perl-Compress-Zlib-1.42-1.el4 > MySQL-python-1.2.1_p2-1.el4.1 > nmap-3.70-1 > sysstat-5.0.5-16.rhel4 > [root@rpm tiago]# > > -- > > [root@rpm tiago]# cat update.out > glibc-devel-2.3.4-2.41.i386.rpm > glibc-devel-2.3.4-2.39.i386.rpm > glibc-devel-2.3.4-2.36.i386.rpm > glibc-devel-2.3.4-2.25.i386.rpm > glibc-devel-2.3.4-2.19.i386.rpm > glibc-devel-2.3.4-2.13.i386.rpm > glibc-devel-2.3.4-2.9.i386.rpm > glibc-devel-2.3.4-2.i386.rpm > libuser-devel-0.52.5-1.el4.3.i386.rpm > libuser-devel-0.52.5-1.el4.1.i386.rpm > libuser-devel-0.52.5-1.i386.rpm > libmudflap-4.1.2-42.EL4.i386.rpm > libmudflap-4.1.2-14.EL4.i386.rpm > libmudflap-4.1.1-53.EL4.i386.rpm > libmudflap-4.1.0-18.EL4.3.i386.rpm > libmudflap-4.1.0-18.EL4.i386.rpm > libmudflap-4.0.2-14.EL4.i386.rpm > libmudflap-4.0.1-4.EL4.2.i386.rpm > libmudflap-4.0.0-0.14.EL4.i386.rpm > xorg-x11-devel-6.8.2-1.EL.52.i386.rpm > xorg-x11-devel-6.8.2-1.EL.33.0.4.i386.rpm > xorg-x11-devel-6.8.2-1.EL.33.0.2.i386.rpm > xorg-x11-devel-6.8.2-1.EL.33.0.1.i386.rpm > xorg-x11-devel-6.8.2-1.EL.33.i386.rpm > xorg-x11-devel-6.8.2-1.EL.31.i386.rpm > xorg-x11-devel-6.8.2-1.EL.19.i386.rpm > xorg-x11-devel-6.8.2-1.EL.18.i386.rpm > xorg-x11-devel-6.8.2-1.EL.13.37.7.i386.rpm > xorg-x11-devel-6.8.2-1.EL.13.37.5.i386.rpm > xorg-x11-devel-6.8.2-1.EL.13.37.2.i386.rpm > xorg-x11-devel-6.8.2-1.EL.13.37.i386.rpm > xorg-x11-devel-6.8.2-1.EL.13.36.i386.rpm > xorg-x11-devel-6.8.2-1.EL.13.25.1.i386.rpm > xorg-x11-devel-6.8.2-1.EL.13.25.i386.rpm > xorg-x11-devel-6.8.2-1.EL.13.20.i386.rpm > xorg-x11-devel-6.8.2-1.EL.13.16.i386.rpm > xorg-x11-devel-6.8.2-1.EL.13.6.i386.rpm > xorg-x11-devel-6.8.1-23.EL.i386.rpm > lam-libs-7.1.2-15.el4:2.i386.rpm > lam-libs-7.1.2-8:2.i386.rpm > MySQL-python-1.2.1_p2-1.el4.1.i386.rpm > MySQL-python-1.0.0-1.RHEL4.1.i386.rpm > sysstat-5.0.5-19.el4.i386.rpm > sysstat-5.0.5-16.rhel4.i386.rpm > sysstat-5.0.5-15.0.1.el4.i386.rpm > sysstat-5.0.5-14.rhel4.i386.rpm > sysstat-5.0.5-11.rhel4.i386.rpm > sysstat-5.0.5-7.rhel4.i386.rpm > sysstat-5.0.5-1.i386.rpm > nmap-3.70-1:2.i386.rpm > [root@rpm tiago]# > > Att, > > -- redhat-list mailing list unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list