Earlier quoted context omitted.
You can’t prove a negative.
There is no largest prime.
We are stuck with egrep and fgrep (unless you like beating people)
291–300 of 354 posts
Re: We are stuck with egrep and fgrep (unless you like beating people)
#292There seems to be a lot of confusion in this discussion about what the change is and how egrep and fgrep work. These are not symlinks like some have suggested but rather shell scripts. You can see the exact commit diff here: https://git.savannah.gnu.org/gitweb/?p=grep.git;a=blobdiff;f... I remember around ~10 years ago being told "you should never use `egrep` because it is slower than `grep -E`." precisely because th…
I am not sure I agree with the logic. On an absolute instruction count scale grep will often dwarf the instructions necessary for the higher level logic captured in the shell script. Insert appeal to andahls law here. Writing in some more optimal language often requires considerably more work, and if the marginal benefit of reducing a few forks is minuscule compared to grep performance, why would you do this?
I’m not saying this as a criticism against shell scripting (I’m an author of an alternative $SHELL and shell scripting language, so do have a love for shell scripting). I’m saying it as a criticism against people who try to optimise against the wrong things.
I guess in a way we are “violently agreeing” (as some say) because your point about the engineering effort mattering more than micro-optimisations is an example of the right kind of optimisations. Which is what I’m also, albeit badly, trying to describe.
Re: We are stuck with egrep and fgrep (unless you like beating people)
#293Earlier quoted context omitted.
If you have interacted with Paul Eggert in real life (I have; he's a professor at UCLA), you would've known that he is a man that values purity over practicality. Not surprising at all.
Is it the same guy that maintains tzdb? https://lwn.net/Articles/870478/
Running
fgrep -U -l -r "Paul Eggert" /usr/bin
should turn up quite a few results. (That's of course an undercount because he doesn't always put his name into everything he touches.)Re: We are stuck with egrep and fgrep (unless you like beating people)
#294Re: We are stuck with egrep and fgrep (unless you like beating people)
#295From RMS:
Following a standard is important to the extent it serves users. We do not treat a standard as an authority, but rather as a guide that may be useful to follow. Thus, we talk about following standards rather than "complying" with them. See the section Non-GNU Standards in the GNU Coding Standards.
We strive to be compatible with standards on most issues because, on most issues, that serves users best. But there are occasional exceptions.
For instance, POSIX specifies that some utilities measure disk space in units of 512 bytes. I asked the committee to change this to 1K, but it refused, saying that a bureaucratic rule compelled the choice of 512. I don't recall much attempt to argue that users would be pleased with that decision.
Since GNU's second priority, after users' freedom, is users' convenience, we made GNU programs measure disk space in blocks of 1K by default.
https://opensource.com/article/19/7/what-posix-richard-stall...
Re: We are stuck with egrep and fgrep (unless you like beating people)
#296Earlier quoted context omitted.
As someone who learned about regular expressions before extensively using grep, I found grep to be quite unintuitive, since extended grep is what I am conceptually thinking about from a “theory” point if view. One difference between grep and compression is that grep is bounded by regular languages, but compression is more free form. It’s conceivable to therefore view grep as mature enough of a technology to be finish…
Consider the popularity of ffmpeg and imagemagick. Putting the mainstream algorithms together under one interface seems to be an appealing model to a lot of people, even though new algorithms are constantly being developed in those areas. Personally, for audio encoding, I'm much happier just installing ffmpeg than I would be gathering and learning a bunch of flac/ogg/opus/mp3/etc encoders.
The difference may also stem from those being application-focused rather than command line, so they don’t have a burden of maintaining legacy applications forever.
Re: We are stuck with egrep and fgrep (unless you like beating people)
#297Earlier quoted context omitted.
Here's one example. This is in code my team inherited a long time ago, and there are many more like it. databases=`find /var/lib/mysql -type d | sed 's/\/var\/lib\/mysql\///g' | egrep -v 'mysql|test|performance|schema'`
That doesn't do anything with stderr, so it doesn't break.
Re: We are stuck with egrep and fgrep (unless you like beating people)
#298Earlier quoted context omitted.
Both of your suggestions are basically equivalent to "think before you upgrade" and/or "don't upgrade". This is the second elephant in the room with all these distros that "don't use globals" and/or statically link everything (or do an analogue to that, like nix). There's very little benefit for desktops. So the upgrade to dependency X breaks component Y, and you are forced not to update X, or at least, Y's copy of X…
> The situation is as unatenable long-term as it is on a regular distro. I may be misremembering, but isn't this pretty much the default user experience on rolling distributions like Arch Linux? -- You consult the wiki to see what changes you need to make are (or maybe see what breaks after an update), make the change, and get on with your desktop experience.
If you like that model, fine, but don't force it onto the whole world, unless you can commit more resources to it than to Arch Linux, and basically keep all upgrade paths alive forever.
Re: We are stuck with egrep and fgrep (unless you like beating people)
#299There seems to be a lot of confusion in this discussion about what the change is and how egrep and fgrep work. These are not symlinks like some have suggested but rather shell scripts. You can see the exact commit diff here: https://git.savannah.gnu.org/gitweb/?p=grep.git;a=blobdiff;f... I remember around ~10 years ago being told "you should never use `egrep` because it is slower than `grep -E`." precisely because th…
Also, where's the extra fork?
#!/bin/sh
exec grep -E "$@"Re: We are stuck with egrep and fgrep (unless you like beating people)
#300Earlier quoted context omitted.
> "if concerned with performance why are you running code as a shell script" Rewrite grep in python before running - got it. :P
That's not what I suggested. I was saying if you're writing performance sensitive code with a hot loop calling `egrep` then a smarter approach might be to use a language better tuned for performance which supports regex libraries. Shell scripts have their place and can out perform most languages if you're writing simple logic that can run across large datasets in parallel, such as cat very-large-file | grep "do not w…
Note that you can write
Instead of cat very-large-file |
To avoid a useless use of cat and keep the direction. Not that I care very much though. Using cat is less surprising to most people.