Surprisingly relevant?
Surprisingly relevant?
Posted May 24, 2020 13:18 UTC (Sun) by madscientist (subscriber, #16861)In reply to: Surprisingly relevant? by Wol
Parent article: The state of the AWK
???
There are no pipes in Jandar's suggested alternative.
This feels more like StackOverflow than LWN, but the issue is that grep foo somefile gives different output than cat somefile | grep foo and if you want the latter behavior while still avoiding UUoC, you should be using grep foo < somefile instead.
Posted May 24, 2020 13:50 UTC (Sun)
by mpr22 (subscriber, #60784)
[Link] (1 responses)
Posted May 24, 2020 17:12 UTC (Sun)
by madscientist (subscriber, #16861)
[Link]
This can be useful in scripting to avoid the complexity of stripping off the unwanted filename.
Posted May 24, 2020 14:02 UTC (Sun)
by Wol (subscriber, #4433)
[Link]
On first thoughts my reaction was "aren't < and > just different syntaxes for pipes?".
My second thought now is that "no they aren't actually pipes, they're shell built-ins".
So yeah you're right. They're pretty much identical in effect (and concept), but different in implementation and impact on the system. There's more than one way to do it ... :-)
Cheers,
Surprisingly relevant?
You're right, grep behaves the same; my bad! I was thinking of some other tools like wc which have different output when given a filename versus reading from stdin.
Surprisingly relevant?
Surprisingly relevant?
Wol