Live data from Hacker News

We are stuck with egrep and fgrep (unless you like beating people)

utcc.utoronto.ca

181–190 of 354 posts

Re: We are stuck with egrep and fgrep (unless you like beating people)

#182

Earlier quoted context omitted.

It’s a show of how free software partisans are often out of touch. The cost of egrep and fgrep is just two symbolic links. Some people though would rather talk about ‘libre’ and ‘free as in speech’ and ‘free as in beer’ than talk at all about the user experience. And they wonder why most people just run windows or macOS, but they’ll never understand.

Aside: What do you mean by "use a symbolic link" (I'm familiar with `ln -s` fwiw) the alias carries the command switch, how do you do that with a link? # example alias egrep='grep -E' ??

A program like "grep" gets the path to the binary in argv[0], if it sees that argv[0] is something like

   /some/path/fgrep
it adds the -E flag. A hard link works OK too, as done copying the whole binary.

Re: We are stuck with egrep and fgrep (unless you like beating people)

#183

Earlier quoted context omitted.

It’s a show of how free software partisans are often out of touch. The cost of egrep and fgrep is just two symbolic links. Some people though would rather talk about ‘libre’ and ‘free as in speech’ and ‘free as in beer’ than talk at all about the user experience. And they wonder why most people just run windows or macOS, but they’ll never understand.

Aside: What do you mean by "use a symbolic link" (I'm familiar with `ln -s` fwiw) the alias carries the command switch, how do you do that with a link? # example alias egrep='grep -E' ??

You use argv0 to check the program name. The utility has to support it in code which GNU apparently dislikes as someone mentioned elsewhere in the thread.

Re: We are stuck with egrep and fgrep (unless you like beating people)

#184

There 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…

> "if concerned with performance why are you running code as a shell script"

Rewrite grep in python before running - got it. :P

Re: We are stuck with egrep and fgrep (unless you like beating people)

#186

There 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…

> though it has already been committed to git for more than a year now and this is the first I've heard people complain about the change.

This reasoning is flawed. I only noticed it a few months back on Arch. So between the time it takes the project to make a new release and it hitting Linux distros (Debian is slower and Ubuntu even moreso), don’t expect a flood of complaints to be time correlated with the change.

Re: We are stuck with egrep and fgrep (unless you like beating people)

#187

Earlier quoted context omitted.

Aside: What do you mean by "use a symbolic link" (I'm familiar with `ln -s` fwiw) the alias carries the command switch, how do you do that with a link? # example alias egrep='grep -E' ??

A program like "grep" gets the path to the binary in argv[0], if it sees that argv[0] is something like /some/path/fgrep it adds the -E flag. A hard link works OK too, as done copying the whole binary.

This is not the case for GNU grep. It appears only some BSDs do this.

Re: We are stuck with egrep and fgrep (unless you like beating people)

#189

Tangentially, I'm still searching for a grep for Windows you can run from file explorer. I've resorted to right-clicking a command window and using findstr. =( I'm sure there's also a powershell equiv but I haven't taken the time to walk the PS object tree to find it.

powershell has `sls` which expands to `Select-String`

Re: We are stuck with egrep and fgrep (unless you like beating people)

#190

I use fgrep all the time. Why should I spend time converting scripts, and retraining my fingers, and forever after taking longer to type grep -F? This is a breaking change that has no upside, only downside. It is idiocy. Just to elaborate, there must be many thousands (hundreds of thousands? millions?) of shell scripts out there that use fgrep. For no reason at all (whatever maintenance burden fgrep represents must b…

There's a certain type of person who gets pleasure from following rules exactly, particularly when other people don't follow those rules. A kind of smug moral superiority. If they get into a position of power, they can make life worse for other people, without much regard for the actual cost of breaking such rules. Removing egrep and fgrep is desperately petty stuff.

If you look at the POSIX standard that removes fgrep & egrep [1], then you can see that most of the utilities being removed there really are quite obscure things.

In light of that, then another (perhaps more charitable) way to look at it is that the maintainers are keen to clean up stuff that they perceive as old cruft, and perhaps don't realise quite how ingrained these particular pieces of "cruft" are into the ecosystem.

(On the other hand: the same POSIX link specifies the removal of cpio and, uh, tar. I'm not sure I see that last one flying.)

[1] https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu...

Post reply on HN