Skip to Content
gnux

-i, --in-place

Edit files in place; -iSUFFIX or --in-place=SUFFIX also keeps each original under that suffix.

An option of sedx.

Usage

sedx -i {script-only-if-no-other-script} [input-file]...
sedx --in-place {script-only-if-no-other-script} [input-file]...

Details

ShortLongValueDefaultMeaning
-i--in-placenoneedit files in place; -iSUFFIX or --in-place=SUFFIX also keeps each original under that suffix

Examples

Point a config file at a new host, keeping the original as config.ini.bak

sedx -i.bak 's/^host = .*/host = db2.internal/' config.ini

Add a line after the one that matches, in every YAML file of a directory

sedx -i '/^dependencies:/a\  - gnux' *.yaml

Remove trailing white space from every source file, in place

sedx -i 's/[[:space:]]*$//' main.go util.go

Help in the terminal

gnux help sedx --in-place

On this page