Antonio Diaz <[EMAIL PROTECTED]> wrote:
> Recently i needed a tool for removing from a text file the lines

Thank you!
However, I'm not sure it's worthwhile to write such a program in C
when it can be done so concisely e.g., with Perl (for N=100):

>    -M, --max-length=<n>     remove lines longer than <n>

  perl -ne 'my $x = $_; chomp; length > 100 or print $x'
  perl -ne 'my $x = $_; chomp; print $x if length <= 100'

>    -m, --min-length=<n>     remove lines shorter than <n>

  perl -ne 'my $x = $_; chomp; length < 100 or print $x'
  perl -ne 'my $x = $_; chomp; print $x if length >= 100'

I readily admit that we can't expect everyone to use Perl, but for
simple things like this, adding a few examples to the manual might be
appropriate.  However, there must already be good collections of useful
Perl one-liners, so maybe a pointer to such a collection would be better.


_______________________________________________
Bug-coreutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to