Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

SED

Brief

Util for parse text and make change on the fly.

Tips

Replace a string on the fly

Let's image the file service.hcl:

service "%NAME_OF_SERVICE%" {
    name    = "name"
    provide = "consul"
}

The goal is change %NAME_OF_SERVICE% to other value, as instance EXAMPLE:

sed -i -e 's/%NAME_OF_SERVICE%/EXAMPLE/g'  service.hcl

Result:

service "EXAMPLE" {
    name    = "name"
    provide = "consul"
}