DE version is available. Content is displayed in original English for accuracy.
Advertisement
Advertisement
⚡ Community Insights
Discussion Sentiment
67% Positive
Analyzed from 765 words in the discussion.
Trending Topics
#file#cat#piping#command#more#grep#awk#program#probably#don

Discussion (38 Comments)Read Original on HackerNews
Program A might accept a file as the last positional arg. Program B might accept it as a named arg, where the name/flag could be anything from --input or -f or --file etc.
But a program will read from STDIN, which all good unix programs do, then piping cat into it works every time. I can write the cat foo.txt part before I even know what command I'm piping it into.
I've probably lost 10ms * 1E5 of my life from the extra PID. But, probably would lose more in the context switch.
Chrome probably spawned two processes when I cmd+clicked this into a new tab. It really doesn't matter.
Personally, when I'm exploring, I build a command line iteratively. Cat the file to see the content, pipe to grep to get the lines I want, sed/awk/cut/etc to finagle from there.
(who gives even a single shit, my god)
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
I guess the file is usually the last argument because it's the one that can be omitted.
When you're building a pipeline, putting cat first can often be quite convenient. Essentially, it's more composable: it defines the input to the pipeline without committing to a specific tool. For example, you can up-arrow in the shell and change the part after the pipe without having to skip back past the filename.
In fact if you don't start with cat, it's possible you're more of a script kiddie than a software developer.
- various HostGator employees, c. 2011
Now for firefox:
Maybe people should be looking at that ? I will not even get into modern Linux Desktops :)< file grep abc