Advertisement

05.14.2008 at 08:10AM PDT, ID: 23401713
[x]
Attachment Details

sort by most recent date

Asked by bt707 in Perl Programming Language

I have a script that prints out data as shown below



#! /usr/bin/perl

use strict;

chdir "/logs/cals";

my @files = `ls -1rt |tail -10`;

foreach my $files (@files) {
  open FILE, $files or die "Can not open $files $!\n";
  while (<FILE>) {
   my $users = /(^\S+)\s+.*user\s+(\S+)\s+Sync.*?\s+.*/;
   print "$2\t$1\n" if $users;
  }
   close FILE;
}



hchandrasekhar  2008/05/10
hchandrasekhar  2008/01/21
hchandrasekhar  2008/03/23
hchandrasekhar  2008/03/09
hodgson2        2008/05/09
hodgson2        2008/05/11
hodgson2        2008/04/12
hodgson2        2008/05/04
hsebastian      2008/02/25
hsebastian      2008/03/15
hsebastian      2008/02/19
hsebastian      2008/05/04

___________________________________________________________________


I'm trying to learn how to put this data in a % then sort it out to get only each users name and Most Recent date, each
name has many dates but I only want to get one entry for each user and get the most recent date. Adam showed me a way
to do this on another script but I'm just not getting it and trying to understand how to sort this out by most recent.


Thanks,Start Free Trial
[+][-]05.14.2008 at 08:33AM PDT, ID: 21565314

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.14.2008 at 08:35AM PDT, ID: 21565334

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Perl Programming Language
Sign Up Now!
Solution Provided By: SmartIntel
Participating Experts: 3
Solution Grade: A
 
 
[+][-]05.14.2008 at 08:36AM PDT, ID: 21565339

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.14.2008 at 09:33AM PDT, ID: 21565969

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.14.2008 at 09:47AM PDT, ID: 21566149

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.14.2008 at 10:14AM PDT, ID: 21566448

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.14.2008 at 10:15AM PDT, ID: 21566460

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.14.2008 at 11:47AM PDT, ID: 21567367

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.14.2008 at 12:14PM PDT, ID: 21567677

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05.14.2008 at 01:17PM PDT, ID: 21568252

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.14.2008 at 01:24PM PDT, ID: 21568316

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.14.2008 at 02:05PM PDT, ID: 21568728

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628