Skip to content

Instantly share code, notes, and snippets.

@ipan
Created January 16, 2018 06:00
Show Gist options
  • Save ipan/fa44d4c608e4efaefa0cfbebd8207c67 to your computer and use it in GitHub Desktop.
Save ipan/fa44d4c608e4efaefa0cfbebd8207c67 to your computer and use it in GitHub Desktop.
using sed to append #sed #unix

Using sed to append something after search pattern.

sed -i '/PATTERN/a\APPENDED' <file>

For example, this will add "sample": "sample x", after "flows": .*, to test_inactive.json

sed -i '/"flows": .*,/a\\ "sample": "sample x",' test.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment