Hacker News new | ask | show | jobs
by throwaway_au_1 1255 days ago
I also don't enjoy coming back to large sed expressions I wrote previously but I'm starting to write them in a way that makes that much easier. I'm on my phone so this will probably be syntactically wrong but hopefully the gist is evident. Basically, load the expression from a commented 'file':

    sed ./target --file=<(cat <<- 
    SED_EXPR | grep -v -E '^\s*#'
        # do a string replacement 
        s#target#replacement#g
        
        # then do something else
        ..
    SED_EXPR
    )