[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SV: finding .m files using 'locate'
From: |
Peter J. Acklam |
Subject: |
SV: finding .m files using 'locate' |
Date: |
Tue, 19 Jul 2005 16:25:32 +0200 (CEST) |
Mike Miller wrote:
>
> Darn it -- I meant to correct that before I sent it. When it is written
> that way (with no 'm') it deletes the newlines. The 'm' is needed, but
> the '.' can be deleted. I had it right in this line near the end of my
> message:
>
> > locate "*.m" | perl -pe 's#(^.*)/[^/]+m#$1#' | sort | uniq
The -l (ell) option is very useful for one-liners like this
locate "*.m" | perl -ple 's#(^.*)/[^/]+$#$1#' | sort | uniq
which can be simplified to
locate "*.m" | perl -ple 's|/[^/]+$||' | sort | uniq
where the "sort" and "uniq" can be removed by using
locate "*.m" | perl -nle 's|/[^/]+$|| ; print unless $d{$_}++'
Peter
- finding .m files using 'locate', Mike Miller, 2005/07/15
- Re: finding .m files using 'locate', Przemek Klosowski, 2005/07/18
- Re: finding .m files using 'locate', Mike Miller, 2005/07/19
- Re: finding .m files using 'locate', Mike Miller, 2005/07/19
- SV: finding .m files using 'locate',
Peter J. Acklam <=
- Re: SV: finding .m files using 'locate', Mike Miller, 2005/07/19
- Re: finding .m files using 'locate', Peter J. Acklam, 2005/07/19
Re: finding .m files using 'locate', Michael W. Martin, 2005/07/15