"Transform Text Like a Pro with sed"

Ғылым және технология

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/jdpedersen1
Email Me At
jake@jpedmedia.com
My Website
jpedmedia.com
Follow Me On Odysee
odysee.com/$/invite/@Jakeatli...
$100 to test a server through Vultr
www.vultr.com/?ref=9174735-8H
Support
Brave users can support me with BAT on my website or on my youtube channel
patreon
/ jakeatlinux
buy me a coffee
www.buymeacoffee.com/jakeQg

Пікірлер: 18

  • @binku09
    @binku097 күн бұрын

    HAHAHA THAT THUMBNAIL IS GOLD

  • @damnhatesyou

    @damnhatesyou

    7 күн бұрын

    Why?

  • @user-ic1ku9np6h

    @user-ic1ku9np6h

    5 күн бұрын

    yeah, trans text like a pro, literally....

  • @sadmold
    @sadmold6 күн бұрын

    Very useful and clear information. Thank you!

  • @dzanful
    @dzanful5 күн бұрын

    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.

  • @anon_y_mousse
    @anon_y_mousse5 күн бұрын

    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 KZread 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?

  • @donaldmickunas8552
    @donaldmickunas85527 күн бұрын

    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. 😉

  • @replikvltyoutube3727
    @replikvltyoutube37277 күн бұрын

    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

    7 күн бұрын

    Indeed, by using another symbol rather than the "/" after the "s" will change the delimiter to that symbol.

  • @donaldmickunas8552

    @donaldmickunas8552

    7 күн бұрын

    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

    5 күн бұрын

    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_gordo6 күн бұрын

    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

    6 күн бұрын

    @@rato_gordo if they are all the same you can run the following: sed -i 's/

  • @rato_gordo

    @rato_gordo

    6 күн бұрын

    @@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

    6 күн бұрын

    @@rato_gordo thanks I appreciate that

  • @scottb4029
    @scottb40293 күн бұрын

    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.

  • @edbeckerich3737
    @edbeckerich37376 күн бұрын

    But I have sed NOTHING...and still got a response, silly software

Келесі