The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

Re: OT Excel(??) macro/auditing help


  • Subject: Re: OT Excel(??) macro/auditing help
  • From: "holymarydudderogod" <yahoo@xxxxxxxxxxxxxx>
  • Date: Fri, 14 Oct 2005 10:59:32 -0000

--- In ukha_d@xxxxxxx, "Stuart Whyte" <groups@f...> wrote:
> So ideally I need a way of telling excel or access (or any other
> suggestions - the file is CSV) to look through the 1400 lines, and
group
> "Microsoft Office Standard Edition 2003 " as one entry, then
count the
> numbers in column B.

I've no idea whether you can do that in excel or access, but if you've
got perl installed anywhere just make a perl file like this, change
the line my $separator = ',' to be my $separator = '\t' if you want
your records to be tab rather than comma separated (or to some other
character if you want to use it instead).

You might need to change the first line too, I've no idea how that
works on windows, you might get away with just leaving out that line
and running the command "perl script.pl" where script.pl is where
you
put this script.

Hope this helps,
Kathryn.


#!/usr/bin/perl

use strict;
use warnings;
my %apps;
my $file = shift @ARGV;
unless (-f $file) { die ("usage\n\t $0 filename\n"); }
open(INFILE, "<$file");
while (<INFILE>)  {
m/(^.*)(\(.*\))\s*([0-9]*$)/;
$apps{$1} += $3;
}
close INFILE;

my $outfile = $file . ".out";
my $key;
my $separator = ",";
open(OUTFILE, ">$outfile");
foreach $key (keys(%apps)) {
print OUTFILE $key . $separator . $apps{$key};
}
close OUTFILE;










UKHA_D Main Index | UKHA_D Thread Index | UKHA_D Home | Archives Home

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.