logoalt Hacker News

peteetoday at 12:41 AM3 repliesview on HN

> Since 1995, occasional awards for UUOC have been given out, usually by Perl luminary Randal L. Schwartz

http://catb.org/jargon/html/U/UUOC.html

Admittedly its taken me a long time to remember that the file is the last argument to grep, when so many other commands its the first. I'd guess common abuse is due to being easier to type cat x | than to dig up the man page


Replies

smelendeztoday at 2:00 AM

And also typing cat x to get a quick look at the file, hitting up, then piping that into another command and taking a look, hitting up, piping that result into a third command etc.

show 1 reply
js2today at 2:09 AM

It's that way so that you can grep multiple files with a single pattern. It would be odd for the pattern to come after the file arguments. It also allows the files to be optional so that it can grep stdin.

soraminazukitoday at 2:07 AM

The redirection operator is consistent and requires less typing though.

I guess the file is usually the last argument because it's the one that can be omitted.