On Wed, 14 Feb 2001 at 4:41pm (-0600), Jonathan Wilson wrote:

> Hey,
>
> I have 2 dirs, one with all the src.rpms of the RH updates, another with
> the i686 rpms. I compiled them all with a for..do loop, but some of them
> didn't compile. I'd like to make a list of each dir and diff them, but
> in order to so, I'd have to trim .src.rpm and .i686.rpm off each
> filename. I was hoping I could do that with grep but it doens't look
> like.
>
> So does anyone have an idea how I could parse these text files and trim
> off the .*.rpm ?

Hmm... lets try...

find SRPMS RPMS/i386 -name *.rpm -printf '%f\n' | sed 's/\.[^\.]*\.rpm$//' |
sort | uniq -c | grep '      1' | awk '{print $2}'

... should so only things that appear just once - that is are only in SRPMS
or are only in RPMS/i686 - although you don't get to see which one.

Acutally just the sed part is what you were asking for but to break down the
rest...

find SRPMS RPMS/i686 -name *.rpm -printf '%f\n'

.. find the all the rpms in our two directores and brings just the basename.

sed 's/\.[^\.]*\.rpm$//'

... chops the <dot>something<dot>rpm off the end of the filename.

sort

... puts them in order so that uniq can handle them.

uniq -c

... counts the number of times each line appears.

grep '      1'

... lets only the files that appeared once through.

awk '{print $2}'

... prints just the filename we're interested in and gets rid of the count.

Slow day. :)

M.

-- 
WebCentral Pty Ltd           Australia's #1 Internet Web Hosting Company
Level 1, 96 Lytton Road.           Network Operations - Systems Engineer
PO Box 4169, East Brisbane.                       phone: +61 7 3249 2583
Queensland, Australia.                            pgp key id: 0x900E515F





_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to