I always felt a bit overwhelmed by the sed man page and never got around to reading and fully understanding it, now I'm sure I will, thanks for this great video.
I'm pretty sure the next command you'll cover will be "awk", but you should definitely do a video on "join". It's one of my favorite commands and quite underrated in my opinion. For those not familiar with it, it lets you do SQL-like joins on text files (and/or stdin).
Indeed, you have to use it carefully if someone else is going to read your code but if you're making some script for your own system that isn't a problem
Thanks, I've never heard of that guy. From his wikipedia page I see he wrote early unix utilities like sed and he's looking like the coolest computer guy in the galaxy with his sunglasses. Anything else I should know?
Awesome content!! I use vim a ton and know many of the ed-style commands, but have never used sed because I’ve gotten good at awk. I’ve always wanted to know send a bit better, and this video was great for that. I have never understood the “pattern command” as clearly - I got confused with “s/pat/repl/flag” not fitting this - but really “s” is just a special function and doesn’t obey these rules. Or maybe you can make this command apply to a range and implicitly it is the whole file. Anyway - would love to see more advanced sed!
The s command is definitely the most complex one but it does obey the same pattern rules as the other commands. You can still sed `/pattern/ s/foo/bar/` if you want.
man 1p sed says otherwise g Globally substitute for all non-overlapping instances of the BRE rather than just the first one. If both g and n are spec‐ ified, the results are unspecified.
I do specify when I use GNU extension (like -E at 5:45 or -i at 13:05) and I try to mention the GNU specific things in most of my videos. Altho 99% of people don't use alpine linux or freebsd so this is definitely not the most important thing to mention
@@cacharle yes, please place greater ephasis on bsd and posix compliant/strict posix, as these are not only more adopted do to mac, but because freebsd, openbsd, netbsd, and dragonflybsd have fewer adopters relative to linux from the lack of an intermediary level of content, either too basic without bigger picture or presumes you are already fairly proficient, the handbooks and man pages help but content creators in actually using the aforementioned help catch blind spots.
@@brakenium436 that's true but as I said in the reply above, I did mention when I use GNU specific thing and I don't want to ramble about different OSes for too long as it would take too much space in a sed focused video
@@VincentLAnderson cmon, I mention it 2 times already. Do you really think a sed tutorial where I spend half of my time in how the different implementation work would be interesting? Not saying it's not an issue, just that it's always a thing taken out of proportion. If you're making scripts to be portable across so many OSes, you're probably advanced enough to look the relevant resources.
My best friend and I had a bet whether he could prove sed is Turing complete before a certain date. He succeeded by creating a Turing machine simulator using the multiline feature. He failed because he started two days after the deadline 😂
I always felt a bit overwhelmed by the sed man page and never got around to reading and fully understanding it, now I'm sure I will, thanks for this great video.
I'm glad it helped you
I'm pretty sure the next command you'll cover will be "awk", but you should definitely do a video on "join". It's one of my favorite commands and quite underrated in my opinion. For those not familiar with it, it lets you do SQL-like joins on text files (and/or stdin).
We'll see for the awk video
I'll definitely look into join, thanks for the recommendation
Thanks for the tip brother! This seems very usefull
how did you customize your cat output?
It's bat a cat rewrite: github.com/sharkdp/bat
thanks for sharing! do `awk` next, the real 'swiss army knife' :)
sed := swiss army knife, awk := the real 'swiss army knife', perl the swiss army knife of swiss army knifes
Sed is a pretty powerful tool with a pretty obscure syntax in non-trivial use cases.
Indeed, you have to use it carefully if someone else is going to read your code but if you're making some script for your own system that isn't a problem
Great video. Love sed.
Great video. Fun fact: Lee McMahon wrote the original sed at Bell Labs
Thanks, I've never heard of that guy. From his wikipedia page I see he wrote early unix utilities like sed and he's looking like the coolest computer guy in the galaxy with his sunglasses. Anything else I should know?
Lol what can we not thank Bell Labs for? It's like the real life Justice League of smart people with several generations.
Awesome content!! I use vim a ton and know many of the ed-style commands, but have never used sed because I’ve gotten good at awk. I’ve always wanted to know send a bit better, and this video was great for that. I have never understood the “pattern command” as clearly - I got confused with “s/pat/repl/flag” not fitting this - but really “s” is just a special function and doesn’t obey these rules. Or maybe you can make this command apply to a range and implicitly it is the whole file. Anyway - would love to see more advanced sed!
The s command is definitely the most complex one but it does obey the same pattern rules as the other commands. You can still sed `/pattern/ s/foo/bar/` if you want.
Nice.
It would have been badass if near the end, you cleaned your file using sed!
It would have been cool idd..
My understanding of the "g" is that it means "greedy" rather than "global".
man 1p sed says otherwise
g Globally substitute for all non-overlapping instances of the
BRE rather than just the first one. If both g and n are spec‐
ified, the results are unspecified.
@@cacharle you can prove anything with facts!
More seriously, thank you for the correction!
You should inform the newcomers that it's GNU sed, not sed. Thanks for the video, btw.
I do specify when I use GNU extension (like -E at 5:45 or -i at 13:05) and I try to mention the GNU specific things in most of my videos. Altho 99% of people don't use alpine linux or freebsd so this is definitely not the most important thing to mention
@@cacharleit is rather important if you want scripts to run on MacOS. It's a fairly big market
@@cacharle yes, please place greater ephasis on bsd and posix compliant/strict posix, as these are not only more adopted do to mac, but because freebsd, openbsd, netbsd, and dragonflybsd have fewer adopters relative to linux from the lack of an intermediary level of content, either too basic without bigger picture or presumes you are already fairly proficient, the handbooks and man pages help but content creators in actually using the aforementioned help catch blind spots.
@@brakenium436 that's true but as I said in the reply above, I did mention when I use GNU specific thing and I don't want to ramble about different OSes for too long as it would take too much space in a sed focused video
@@VincentLAnderson cmon, I mention it 2 times already. Do you really think a sed tutorial where I spend half of my time in how the different implementation work would be interesting?
Not saying it's not an issue, just that it's always a thing taken out of proportion. If you're making scripts to be portable across so many OSes, you're probably advanced enough to look the relevant resources.
Where to learn this
RTFM 😄 (in this case man 1p sed)
❤
Great video! Thank you! Maybe you could do some vídeos about fish shell
Three steps ahead of you! ua-cam.com/video/CiIT-dEDlDM/v-deo.html
what this cat command is? some code of yours? it does not look like regular cat. great vid, btw.
It’s bat
It's bat, a more modern version of cat: github.com/sharkdp/bat
My best friend and I had a bet whether he could prove sed is Turing complete before a certain date. He succeeded by creating a Turing machine simulator using the multiline feature. He failed because he started two days after the deadline 😂
ahahah that's awesome! I'd love to take a look at the project if you have a link
@@cacharle this was in 1999, don't know if he still has it
French accent ?
ok, i'm making a bot that automatically responds to all the french accent comments, this is the 100th time i see this
😂
yes it is, sed:
Search
End
Dreplace
Lol, I think it stands for Stream ed maybe 🤔