GNU bug report logs -
#65416
Feature request: include first line of file in output
Previous Next
Reported by: Daniel Green <ddgreen <at> gmail.com>
Date: Mon, 21 Aug 2023 07:16:02 UTC
Severity: wishlist
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Le jeu. 24 août 2023 à 08:58, Daniel Green <ddgreen <at> gmail.com> a écrit :
> Re Perl's read speed, it's faster when not doing the line number check for
> every line. So `perl -ne 'print if (/pattern/)'` is only ~2.60s, compared
> to ~3.28s for `perl -ne 'print if ($. == 1 || /pattern/)'`. Doing nothing
> in Perl, i.e., `perl -ne ''` is only ~1.38s.
>
> Dan
>
> On Wed, Aug 23, 2023 at 6:22 PM Paul Jackson <pj <at> usa.net> wrote:
>
> > Ah - those times show another reason why one might
> > be motivated to keep requesting more options be added
> > to grep.
> >
> > From those timings, and from looking at the source, it's clear
> > that the FSF rewrote grep from scratch, sometime back in the
> > late 1980's or early 1990's, to have fast reads, whereas sed is
> > still using stdio fread in a classical manner, which is a painfully
> > slower double copy solution.
> >
> > If sed were still a widely used command in performance sensitive
> > applications, it should have some serious TLC applied to its
> > performance.
> >
> > However, since the pool of Jurassic Park Dinosaurs who can (and
> > perhaps do) compose sed commands in their sleep is a nearly
> > extinct breed, I see no sufficient interest in accepting such a rewrite
> > of sed, even if it showed up as a proposed checkin.
> >
> > That grep can even seriously beat perl for such raw read performance
> > is impressive. Perl used to be the King of such challenges.
> >
> > --
> > Paul Jackson
> > pj <at> usa.net
> >
> >
> >
>
with a function, something like this :
headgrep() {
head -1 "$2"
grep "$1" "$2"
}
[Message part 2 (text/html, inline)]
This bug report was last modified 1 year and 321 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.