5 ms·
Now all we need is someone to modify less to recognize that its standard in is connected the output of more so that if you type `cat /etc/passwd | more | less`
by ChuckMcM 10y ago
Now all we need is someone to modify less to recognize that its standard in is connected the output of more so that if you type `cat /etc/passwd | more | less` it could output something which, more or less, looked like the input.
- billforsternz 10y agoI see what you did there. I think.
- wiredfool 10y agoThe problem is less that we have fossilization and pointless cruft around basic utilities, it's more that the replacements are written by people with a sense of humor, and their sense of humor is distinctly punny.
- knz42 10y agoIt actually works already :) (more does not page if its stdout is not a terminal)
- jjnoakes 10y agoThat only gets you half way. You also need less to not page its input to its output if it detects "more" is on stdin (much harder).
- SixSigma 10y agoI hereby award you a "Useless use of cat" award [1] more < /etc/passwd | less http://porkmail.org/era/unix/award.html#cat http://porkmail.org/era/unix/award.html#cat
- mudetroit 10y agoor just more /etc/passwd | less ¯\_(ツ)_/¯
- taneq 10y agocat /etc/passwd | head -n X | tail -n Y Print lines X-Y to X of a file. :D
- yk 10y agoClearly cat is used for clarity in the joke, such that the more or less pun is more obvious. I therefore consider the use of cat in this instance good programming praxis. (Of course good programming praxis in bash is a bit like safe driving in formula one.)
- Infernal 10y agoSomehow when I was learning Linux/UNIX 13 years ago, my default way of grepping for something in a file became `cat foo | grep bar`. I've tried, a bit, to break this habit, but can never stick with it. The only time it slows me down is when I'm trying to show someone something and they interrupt to ask why I do it that way :)
- dTal 10y agoI love that the same set of people who like to wax poetic about the elegance of pipes and composable single-purpose tools are the most pedantic about not doing all that when a single tool happens to have all the features you strictly need, monolithically built in. Never mind that STDIN works the same on all processes, while the file argument is highly inconsistent! Never mind that the expansion of single tools to encompass common tasks is widely regarded as a pox on the cleanliness of UNIX! You must learn all the options! Minimize the number of processes! You have 16 GB of RAM but that unnecessary 'cat' is UNACCEPTABLE!
- arbitrage 10y agoIt's not a bad idiom to use. You can keep retrieving the last command, and change the grep term quickly with ^w . When the search argument to grep is in the middle of the line, you can't easily iterate over a bunch of search terms by hand.
- expression 10y agoDid you know you can start the command with the redirection operator? <input-file grep stuff Unless you are concatenating stuff, I see no reason to use cat.
- gpm 10y agoWhat if you just want to view the contents of input-file, unpaged. `<input-file` doesn't print anything unfortunately (curiously it doesn't error either).
- deleted 10y ago[deleted]