"Transform Text Like a Pro with sed"

  Рет қаралды 1,176

Jake@Linux

Jake@Linux

Күн бұрын

Covering the unix tool of Sed, the stream editor. In this video I will give 3 examples of how you can use sed to manipulate text on Linux
Gitlab
gitlab.com/jped
Github
github.com/jdp...
Email Me At
jake@jpedmedia.com
My Website
jpedmedia.com
Follow Me On Odysee
odysee.com/$/i...
$100 to test a server through Vultr
www.vultr.com/...
Support
Brave users can support me with BAT on my website or on my youtube channel
patreon
/ jakeatlinux
buy me a coffee
www.buymeacoff...

Пікірлер: 18
@binku09
@binku09 2 ай бұрын
HAHAHA THAT THUMBNAIL IS GOLD
@damnhatesyou
@damnhatesyou 2 ай бұрын
Why?
@user-ic1ku9np6h
@user-ic1ku9np6h 2 ай бұрын
yeah, trans text like a pro, literally....
@donaldmickunas8552
@donaldmickunas8552 2 ай бұрын
Jake, The real power, in that third example, was in all of that middle part in the sed command. Those are regular expressions which is a language all it's own. Awk. Sed, and Regular Expressions, when used together effectively, can manipulate large amounts of text quickly. Most computer users today have never heard of these tools mainly because they require some work to learn how to use. Most people aren't willing to put in the work. I think that is a bad decision. I started diving into Regular Expressions about a year ago, using the classic book "Mastering Regular Expressions by Jeffery Friedl", but health issues put a stop to that endeavor. It is time to jump back in. 😉
@dzanful
@dzanful 2 ай бұрын
Your statement that the `-E' flag enables extended regular expressions is true, but can be easily misunderstood. Actually, the only difference between regular and extended regular expressions is that in the latter, special characters like '?', '+' and '()' aren't escaped with a backslash '\' character, otherwise they become literal. So the main purpose of ERE is to make regular expressions more readable and less prone to human error. Consider the following two sed commands, with and without the `-E' flag, both producing the same output: $ echo a b | sed -E 's/(\S+)\s(\S+)/\2 \1/' b a $ echo a b | sed 's/\(\S\+\)\s\(\S\+\)/\2 \1/' b a However, basic regular expressions may be more convenient in some cases: $ echo '(a) (b)' | sed 's/(\w)/(x)/g' (x) (x) $ echo '(a) (b)' | sed -E 's/\(\w\)/(x)/g' (x) (x) Understanding this small difference between BRE and ERE can save a lot of time and confusion when working with sed and grep. But there's so much more sed can do, including flow control, which is rarely if ever mentioned by most content authors on the web.
@sadmold
@sadmold 2 ай бұрын
Very useful and clear information. Thank you!
@anon_y_mousse
@anon_y_mousse 2 ай бұрын
Only recommendations I have is to do a whole word search when replacing simple strings like 'cat'. For instance, if you have a file listing 'Categories of Cats' and you don't do whole word, you'll get 'Dogegories of Dogs'. For whole word, enclose in alligator clips which I can't demonstrate without my post being deleted (not your fault, just KZbin hates me). Also, if you are deleting based on a potentially mixed case string, if you're using GNU `sed`, then you can use 'Id' instead of just 'd'. Note that's capital eye before the dee. I'm told it's not portable, but who actually uses a different version of `sed` if you're on Linux?
@scottb4029
@scottb4029 2 ай бұрын
Sed and AWK are cool, but not as cool as set. Loved the video. I am worried about you, what is going on with your throat? Btw tea with honey coats the vocal cords.
@replikvltyoutube3727
@replikvltyoutube3727 2 ай бұрын
Slashes Can be actually any symbol IIRC. Since slashes can make problems with escaping and usage in bash scripts, it's better to use some not interpreted symbol like ! or @
@donaldmickunas8552
@donaldmickunas8552 2 ай бұрын
Indeed, by using another symbol rather than the "/" after the "s" will change the delimiter to that symbol.
@donaldmickunas8552
@donaldmickunas8552 2 ай бұрын
Jake, You should do more short videos like this one. No one is teaching this stuff any more. Regular Expressions can be used in many Linux commands. Knowing them can allow the user to accomplish much in a few lines of code. Powerful, heady stuff when applied.
@anon_y_mousse
@anon_y_mousse 2 ай бұрын
I often use a comma because it's easy to type and not generally in any strings I process in that way.
@rato_gordo
@rato_gordo 2 ай бұрын
I'm trying to solve a need while being a noob. I have 37 html files where I want to change the code, e.g. I forgot a alt tag for an image. With sed it is possible to do it in all files at once? I'll definetely read sed man asap ;)
@JakeLinux
@JakeLinux 2 ай бұрын
@@rato_gordo if they are all the same you can run the following: sed -i 's/
@rato_gordo
@rato_gordo 2 ай бұрын
@@JakeLinux thx for the help! I'll look into It and make tests, before losing stuff, lol. As another folk commented here... time to start learning regex. Your videos are really good Jake!
@JakeLinux
@JakeLinux 2 ай бұрын
@@rato_gordo thanks I appreciate that
@edbeckerich3737
@edbeckerich3737 2 ай бұрын
But I have sed NOTHING...and still got a response, silly software
3 ways to use the Set command to improve your Bash scripts
9:57
Jake@Linux
Рет қаралды 1,2 М.
Building a Void-src template for Brave
24:51
Jake@Linux
Рет қаралды 1,4 М.
这三姐弟太会藏了!#小丑#天使#路飞#家庭#搞笑
00:24
家庭搞笑日记
Рет қаралды 118 МЛН
Whoa
01:00
Justin Flom
Рет қаралды 55 МЛН
КТО ЛЮБИТ ГРИБЫ?? #shorts
00:24
Паша Осадчий
Рет қаралды 4,4 МЛН
Building a terminal file manager in Bash
25:57
Jake@Linux
Рет қаралды 5 М.
Linux Crash Course - The sed Command
15:25
Learn Linux TV
Рет қаралды 122 М.
Why Are Open Source Alternatives So Bad?
13:06
Eric Murphy
Рет қаралды 627 М.
The BEST Text Editor on Linux? - Micro Text Editor
9:26
Planet Linux
Рет қаралды 18 М.
Lite-XL...A Simple Yet Powerful Text Editor
10:46
DistroTube
Рет қаралды 16 М.
How to setup Pipewire on Void Linux
11:45
Jake@Linux
Рет қаралды 5 М.
This VIM trick BLEW MY MIND
6:37
typecraft
Рет қаралды 48 М.
Manage Your Dotfiles with Home Manager!
32:06
LibrePhoenix
Рет қаралды 57 М.
7 Apps Better Than The Defaults Your Distro Ships
12:43
DistroTube
Рет қаралды 57 М.
这三姐弟太会藏了!#小丑#天使#路飞#家庭#搞笑
00:24
家庭搞笑日记
Рет қаралды 118 МЛН