Re: gnu grep auf 2.5 updaten

From: Karsten Radusch <karsten.radusch(at)informatik.tu-cottbus.de>
Date: Thu, 12 Aug 2004 16:44:48 +0200

On Wed, Aug 11, 2004 at 04:19:18PM +0200, thomas peter wrote:
> hi,
> wie kann ich denn mein grep auf 2.5 updaten?
> laut
> http://cvsup.pt.freebsd.org/cgi-bin/cvsweb/cvsweb.cgi/src/gnu/usr.bin/grep/
> ist in 4.10 als auch in 5.2.1 immer grep 2.4x
> manuell bei FSF besorgen und selbst compilen?
>
> konkret h?tte ich gerne grep -o
> -o, --only-matching
> Show only the part of a matching line that matches
> PATTERN.
>

Hallo,

wie von Olli gesagt, geht das u.a. auch mit awk

#! /usr/bin/awk -f
#
# match.awk - Zeichenkette ausgeben, die sie auf einen regulaeren Ausdruck
# matched
# match.awk regex dateiname

BEGIN {
  regex = ARGV[1];
  delete ARGV[1];
}

{
  if (match($0, regex))
    {
      print substr($0, RSTART, RLENGTH);
      # folgende Anweisung auskommentieren wenn alle Vorkommen von regex
      # gefunden werden sollen
      exit 0;
    }
}

Tschuess,
Karsten

To Unsubscribe: send mail to majordomo(at)de.FreeBSD.org
with "unsubscribe de-bsd-questions" in the body of the message
Received on Thu 12 Aug 2004 - 16:47:15 CEST

search this site