Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jun 2001 10:47:05 +0100
From:      Matthew Seaman <matthew.seaman@tornadogroup.com>
To:        Valentin Nechayev <netch@iv.nn.kiev.ua>
Cc:        Cyrille Lefevre <clefevre@redirect.to>, Matthew Seaman <m.seaman@plasm.demon.co.uk>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: Perl module for periodic scripts
Message-ID:  <3B25E519.ED3BE981@tornadogroup.com>
References:  <20010611102830.A26191@plasm.demon.co.uk> <u21mpl9x.fsf@gits.dyndns.org> <20010612105318.B923@iv.nn.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
Valentin Nechayev wrote:
> 
>  Tue, Jun 12, 2001 at 02:57:46, clefevre-lists (Cyrille Lefevre) wrote about "Re: Perl module for periodic scripts":
> 
> > FYI, the date stuff can be written in pure shell. don't know yet
> > about the uniq -i but should be possible w/o perl.
> 
> tr '[A-Z]' '[a-z]' | uniq
> (does this uniquing requires to preserve case of at least one variant?
> I suppose no)

Hmmm...

claudette:/tmp:% cat /tmp/foo 
aaa
aaa
aaa
AAB
aab
aab
AAB
AAC
aac
AAC
aac
aac
aac
aac
aad
AAD
AAD
aad
aad
claudette:/tmp:% cat /tmp/foo | sort -f | uniq -ic 
   3 aaa
   4 AAB
   7 AAC
   5 AAD
claudette:/tmp:% cat /tmp/foo | tr '[A-Z]' '[a-z]' | sort | uniq -c
   3 aaa
   4 aab
   7 aac
   5 aad
claudette:/tmp:% cat /tmp/foo | perl -ne '$s{lc $_}++; END { for (sort keys %s) { printf "%4d $_", $s{$_}; }}'
   3 aaa
   4 aab
   7 aac
   5 aad

It's not quite the same, but probably good enough.  

> > see the following url on a portable (awk and ksh) replacement for
> > date -v-1d :
> 
> Then the program will contain perl, ksh and awk code? There are too many
> languages used, aren't there? Also realize please that base system does not
> contain ksh. Monolithic perl code, without awk & ksh, will be better because
> perl is in base system already...

Quite so.  The current admixture of sh and perl in 470.status-named seems unaesthetic
to me.

On the other hand, FreeBSD /bin/sh is a lot more like Solaris /bin/ksh than it is like Solaris /bin/sh.  Cyrille's ksh code should
port fairly readily to FreeBSD /bin/sh.

	Matthew

-- 
Matthew Seaman                                         Tel: 01628 498661

        Certe, Toto, sentio nos in Kansate non iam adesse.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3B25E519.ED3BE981>