sorting multiple different entries using Perl

Discussion in 'Perl Misc' started by rusneht, Nov 26, 2003.

  1. rusneht

    rusneht Guest

    Hi All ,
    Am not sure which way to go to handle this case; hence am looking for
    suggestions.

    Data that I need to handle is this:

    /vob/dir/file1@@/br1/10
    /vob/dir/file1@@/br1/9
    /vob/dir/file1@@/br1/8
    /vob/dir/file2@@/br1/3
    /vob/dir/file4@@/br1/7

    I would like to extract from this list, not unique values, but an
    output like this :

    /vob/dir/file1@@/br1/10
    /vob/dir/file1@@/br1/8
    /vob/dir/file2@@/br1/3
    /vob/dir/file4@@/br1/7

    As you can see if a file has multiple entrues I would like to take
    most recent and old ones from list; if only one entry for a file only
    that needs to be extracted.

    Any ideas or suggestions ?

    --TIA,
    Ramthen
     
    rusneht, Nov 26, 2003
    #1
    1. Advertising

  2. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    (rusneht) wrote in
    news::

    > Data that I need to handle is this:
    >
    > /vob/dir/file1@@/br1/10
    > /vob/dir/file1@@/br1/9
    > /vob/dir/file1@@/br1/8
    > /vob/dir/file2@@/br1/3
    > /vob/dir/file4@@/br1/7
    >
    > I would like to extract from this list, not unique values, but an
    > output like this :
    >
    > /vob/dir/file1@@/br1/10
    > /vob/dir/file1@@/br1/8
    > /vob/dir/file2@@/br1/3
    > /vob/dir/file4@@/br1/7
    >
    > As you can see if a file has multiple entrues I would like to take
    > most recent and old ones from list; if only one entry for a file only
    > that needs to be extracted.


    I don't follow what you mean by "most recent and old ones". Why is br1/9
    not output for file1, but br1/10 and br1/8 are?

    - --
    Eric
    $_ = reverse sort $ /. r , qw p ekca lre uJ reh
    ts p , map $ _. $ " , qw e p h tona e and print

    -----BEGIN PGP SIGNATURE-----
    Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

    iQA/AwUBP8f8A2PeouIeTNHoEQLYLwCg8bhs/P1TYHJprT2dHIZcK4eVH7QAoJEx
    HIeQB8PbUg9L1Nh3Kv8Vf/UW
    =PG2u
    -----END PGP SIGNATURE-----
     
    Eric J. Roode, Nov 29, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Topher
    Replies:
    1
    Views:
    1,132
    Gunnar Hjalmarsson
    Jan 21, 2004
  2. Mike D
    Replies:
    2
    Views:
    335
    Mike D
    Oct 27, 2008
  3. Peter Otten
    Replies:
    3
    Views:
    284
    Peter Otten
    Jan 29, 2010
  4. Don Bruder
    Replies:
    3
    Views:
    979
    spikeysnack
    Aug 3, 2010
  5. Tom Kirchner

    sorting by multiple criterias (sub-sorting)

    Tom Kirchner, Oct 11, 2003, in forum: Perl Misc
    Replies:
    3
    Views:
    478
    Michael Budash
    Oct 11, 2003
Loading...

Share This Page