You know what? Iβm gonna cat into grep even harder now
linuxmemes
Hint: :q!
Sister communities:
Community rules (click to expand)
1. Follow the site-wide rules
- Instance-wide TOS: https://legal.lemmy.world/tos/
- Lemmy code of conduct: https://join-lemmy.org/docs/code_of_conduct.html
2. Be civil
- Understand the difference between a joke and an insult.
- Do not harrass or attack users for any reason. This includes using blanket terms, like "every user of thing".
- Don't get baited into back-and-forth insults. We are not animals.
- Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
- Bigotry will not be tolerated.
3. Post Linux-related content
- Including Unix and BSD.
- Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of
sudoin Windows. - No porn, no politics, no trolling or ragebaiting.
- Don't come looking for advice, this is not the right community.
4. No recent reposts
- Everybody uses Arch btw, can't quit Vim, <loves/tolerates/hates> systemd, and wants to interject for a moment. You can stop now.
5. π¬π§ Language/ΡΠ·ΡΠΊ/Sprache
- This is primarily an English-speaking community. π¬π§π¦πΊπΊπΈ
- Comments written in other languages are allowed.
- The substance of a post should be comprehensible for people who only speak English.
- Titles and post bodies written in other languages will be allowed, but only as long as the above rule is observed.
6. (NEW!) Regarding public figures
We all have our opinions, and certain public figures can be divisive. Keep in mind that this is a community for memes and light-hearted fun, not for airing grievances or leveling accusations. - Keep discussions polite and free of disparagement.
- We are never in possession of all of the facts. Defamatory comments will not be tolerated.
- Discussions that get too heated will be locked and offending comments removed. Β
Please report posts and comments that break these rules!
Important: never execute code or follow advice that you don't understand or can't verify, especially here. The word of the day is credibility. This is a meme community -- even the most helpful comments might just be shitposts that can damage your system. Be aware, be smart, don't remove France.
You can actually change the functionality of some punctuation, such as is used in my favorite command
:(){:|:};:
What the fork does this even do?
Create a function named : which runs :|: (calls itself and pipes the output to itself). Then it closes the function and uses a semicolon to end the function definition. Next run a command :.
TLDR it's a bash fork bomb
Oh I'm familiar, I was just being punny. Thanks for explaining for those that don't know, though!
Call it for a good time.
I like to alias this to |
..... That's awful, does it work?
Edit: I guess it would need a semicolon or another pipe in the alias
I heard one popular glorp youtuber say "Only glorp hemptets ship into mleb" Bitch I ship into blep all I fucking want, it's more readable, and I piss whenever I fucking can. I piss two pisses before I piss two pisses, and then I piss more
Yes I know putting two pisses in a row will break your bone. I've done it several times before by accident.
implying I give a fuck
The fuck is a glorp YouTuber?
Glorp is the spiritual successor to Fleeb, though mostly ran by the people behind Pumbu (the ones who started it, not the ones who ran it into the ground) and Muupi (the ones who ran it into the ground).
I think I developed a brain bleed reading this
Glorp is on Poob. You can find it on Poob. You can go to Poob and get it. Log onto Poob right now. Go to Poob. Dive into Poob. You can Poob it. It's on Poob. Poob has it for you. Poob has it for you.
It is for when the processes get krangled.
Do you pipe two pipes in times of peace, and two in times of war?
Cat into grep lets you insert something between the file read and grep if you need to without having to reorder anything
I understood a couple of those words. None of the technical ones, but some of them! They were expletives⦠But I understood them!
I prefer | less or less file.txt because I can search interactively
I prefer less until I find myself using less over and over again until I finally use cat so that I can just scroll up and review whatever I'm looking for.
Is it the best or right way to do things? Nope, but it gets the job done just as good as anything else I do.
And, it goes without saying, I do a terrible job of all of it.
what about $EDITOR <(cat file)?
Well, when I can just do $EDITOR file...
we're talking about a pipeline(-ish) thing here.
so just out the cmd that you want to read the output of in the brackets
Ok but what is supposed to be bad about grepping into cat? I don't get it
Edit: thanks for the replies all, I didn't know you could add a file as an argument in grep. Makes sense now :)
It's less relatable now, and the technology was fucking stupid to begin with, but: Imagine printing out a document and feeding the sheets into a fax machine instead of just sending the file directly to the machine.
Or using a cassette tape adapter to play music from your phone through a stereo system when that system has a built-in Aux port you could plug directly into ("Useless Use Of Cassette?").
cat'ing into grep, and a handful of other programs people commonly pipe into from cat, is pointless when grep can be called directly against a file. cat is being run for no reason; a useless use of cat (uuoc). It means fuckall for most people today but I imagine it could've been an actual concern when hardware was much more limited and multiple users were connecting to a single system.
cat file.txt | grep foo is unnecessary and a bit less efficient, because you can do grep foo file.txt instead. More generally, using cat into a pipe is less efficient than redirecting the file into stdin with <, like grep foo < file.txt.
The video I saw was saying cat into grep is totally fine in day to day life do whatever comes out of your fingertips naturally, but if you're making a bash script for others to use, use grep args because cat pipe grep can do some strange stuff with error handling. Which I have no experience with, but sounds reasonable
Grep can accept input from stdin as with a piped cat, but I it can also just call the file directly.
In 99.999% ^obviously^ ^made^ ^up^ ^stat^ ^is^ ^obvious^ of situations its fine.
The real issue is a piped cat into grep will fork the process. Why open two process threads when one would do the job?
Edit: it was mentioned by but to expand a bit: piping cat into grep can also mask quite a few errors. It masks them because of how the shell handles error reporting on piped processes. IIRC, if the file is missing for example, you won't necessarily know that because while cat will throw a not-found error, that gets piped into grep who gladly accepts the error (which was piped to stdin) as its input and greps through the error, reporting back that your content wasn't found in the search material, not that the file was missing.
What the fork is this forking shirt?
Soz I read your comment as if it were from the good place.
i think the alternative is to use grep args. but ya know iβm living in the future using nushellβs open command and ripgrep so the argument is just kinda adorable
How parsing (as in programming languages and commands) works is so interesting and is so hard for people to grasp and is really interesting to see how what you think is obvious is not for most people. I saw it all the time when teaching cs102. It is so hard to explain the difference that a blank space makes and why sometimes it is necessary and why sometimes it is not.
That is all to say I find it really interesting and funny when OP says double pipe, because of course it looks like double pipe, you gonna tell me That || is something completely different than a single | ?
just gotta tee