• 1 Post
  • 11 Comments
Joined 2 years ago
cake
Cake day: September 15th, 2023

help-circle


  • I meant to ask what is the difference between, i.e., sed '/myregex/ s/from/to/ p' and sed '/myregex/ s/from/to/ ; p', but while testing to explain what i meant I answered myself, and in the process I also understood what addresses are ehe

    Right, awk is a proper programming language, right? that’ll be for another day…


  • orsetto@lemmy.dbzer0.comOPtoLinux@lemmy.mlHelp with sed commands
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    12 hours ago

    !/dev/dm-2!!p

    This weired me out until I read the explanation. I’m so used to the slashes lol

    In the end I’ve used the first command you wrote, because KISS, but I appreciate your explanation

    Check the sed man page for more details

    Yes that’s been my only source so far, but to be honest it’s really cryptic. it might just be that I’m used to syscalls man pages (also sed is kinda complex it can’t be easy to write a single man page for it)


  • The -n suppresses auto-printing

    That’s something I was missing! It makes the command look definitely less complicated.

    Also, what is the difference between separating expressions with a space vs with a semicolon?

    Easier IMHO is awk

    Eh, that’s another beast. For some reason tho I find sed more appealing.