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 [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to