VehiclesFashionRecipesBlogsHuntTravelsSportFunHandmadeITEducation
Mini-Games
x

x
zakruti.com » IT - Software » IT, programs, coding
Learning Sed Is Beneficial For Linux Users DistroTube

Learning Sed Is Beneficial For Linux Users DistroTube

FBTwitterReddit

video description

Rating: 4.0; Vote: 1
Learning Sed Is Beneficial For Linux Users DistroTube sed is a stream editor. A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline). The most common usage of sed involves substituting a pattern or string for another string. But sed can be used for many tasks. It's a powerful command line utility that should be in everyone's tool bag. - https://www.gnu.org/software/sed/manual/sed.html - Sed Manual
Date: 2022-03-30

Comments and reviews: 10


I recently saw your awk video and now this sed video. Both are really great and I have learned a lot. Just one thing I want to point out as I had this issue just this week:
If you have a big file e.g. let's say 3Gb log file and want to have 1000 line starting at line 30000 sed is a lot quicker then awk with this.
In my test -sed -n '30000,31000p' file.log- took like 3 seconds while -awk 'NR==30000,NR==31000 -print $0-' file.log' took almost a minute

reply

When creating sed regex expression it's a good idea to check what has been modified:
$ sed '...' inputfile - diff inputfile
you can pipe it further to a program that colorizes text:
$ sed '...' inputfile - diff inputfile - bat -l diff
For vim users you can use vimdiff (easier side by side comparison), but -process substitution- has to be used to trick vim that pipe is a file:
$ vimdiff inputfile

reply

im sorry, but i cant read anything, im in my 50s and your terminal size is so small compared to your other videos ... not everybody has a 65 inch monitor, some are sitting in front of a 14 laptop, plz change this in your future videos, im kinda angry as this was very interesting to me, but its only an audio possibility for me, no thumb down given, only this constructive critic :(
reply

More useful CLI commands -- Search for fzf. -Why you should be using fzf, the command line fuzzy finder- -- Pure command line CLI with NO file managers .
Example .. ls - fzf -m
Also checkout.. --- -Why I fell in Love with GNU Emacs- and --- -Pro Linux users don't need file managers-

reply

I actually think that the space search pattern is not optimised, it is way better to use a '+' since it will only act when it is 1 or more instead of 0 or more. With '-', the command will make an action every single line, that's unefficient.
reply

Hello dt , i know this may be far fetched but is there a chance you can make an iso of your arch with all the theming and text editors (emacs) and terminal configuration settings for your viewers. I really appreciate your arch setup.
reply

I want to add this sed, I use this to edit my host file. This will essentially add a line of text after the first match pattern. For example ==== sed -i '0,/pattern/!b;//a[the text u want to add]' filename
reply

if you ask me if you are doing a lot of bash scripting yes sed is usefull but if you are like me and tend to go for other -proper- programming languages like python or c# not sure sed is verry usefull
reply

when -i option was added to sed, that was life changing - and that can use -e to specify multiple expressions to apply on the stream - sed is kind of like the single most potent unixy power tool
reply

'Pro' tip: most shells will clear the screen when you hit CTRL-L :)
[edit] Oh, and CTRl-A and CTRL-E will take you to the beginning/end of the line (i.e. Emacs navigation commands).

reply
Add a review, comment






Other channel videos