Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'View a Lord of the Rings timeline easter egg in calendar' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
View a Lord of the Rings timeline easter egg in calendar
Authored by: foobar104 on Jan 13, '04 02:47:12PM
Almost every use of "cat SINGLEFILE | ...somecommand..." is wrong. Learn!

If anybody was wondering why UNIX hasn't taken over the world, there you go.

There is absolutely nothing wrong about this use of cat. No, it's not necessary, but it works just fine. In this particular instance, it's my preferred idiom for searching a single file, because I can't reliable remember whether grep's command-line syntax is "grep pattern file" or "grep file pattern." In other words, I can't remember whether to think "search for this in that" or "search that for this."

With cat and a pipe, I don't have to.

UNIX is great. UNIX is fantastic. People who look at a perfectly good way of doing something with UNIX and fly off the handle, call it wrong, and command those who use it to "Learn!" kinda suck, however.

[ Reply to This | # ]

View a Lord of the Rings timeline easter egg in calendar
Authored by: SeanAhern on Jan 13, '04 04:52:03PM
I can't reliable remember whether grep's command-line syntax is "grep pattern file" or "grep file pattern."

Here's a way that I remember. Grep searches multiple files for one pattern. That means that you specify the pattern first, then a bunch of files. "grep pat *" searches all files for the pattern "pat". With this in mind, it's relatively easily to reminder, since "grep * pat" is simply never seen.

Don't know if this helps, but it works for me.

---
-Sean

[ Reply to This | # ]